Jump to content
Fivewin Brasil

TDolphin Alteração ( Update ) - Resolvido


aferra

Recommended Posts

Nenhuma das opções deu certo

::oDbfCli:Save()
ou
cQuery := "UPDATE advsys.arqcli SET "
cQuery += "cod=" + ClipValue2SQL( ::oDbfCli:cod ) + ","
cQuery += "nom=" + ClipValue2SQL( ::oDbfCli:nom ) + ","
cQuery += "cgc=" + ClipValue2SQL( ::oDbfCli:cgc ) + ","
cQuery += "alterar=" + ClipValue2SQL( ::oDbfCli:alterar ) + ","
cQuery += "usuario=" + ClipValue2SQL( ::oDbfCli:usuario ) + " WHERE "
cWhere := "cod" + ;
If( ( cData := ClipValue2SQL( ::oDbfCli:hRow[ '_cod' ] ) ) == "NULL", " IS ", " = " ) +;
cData + " AND "
cWhere += "nom" + ;
If( ( cData := ClipValue2SQL( ::oDbfCli:hRow[ '_nom' ] ) ) == "NULL", " IS ", " = " ) +;
cData + " AND "
cWhere += "cgc" + ;
If( ( cData := ClipValue2SQL( ::oDbfCli:hRow[ '_cgc' ] ) ) == "NULL", " IS ", " = " ) +;
cData + " AND "
cWhere += "alterar" + ;
If( ( cData := ClipValue2SQL( ::oDbfCli:hRow[ '_alterar' ] ) ) == "NULL", " IS ", " = " ) +;
cData + " AND "
cWhere += "usuario" + ;
If( ( cData := ClipValue2SQL( ::oDbfCli:hRow[ '_usuario' ] ) ) == "NULL", " IS ", " = " ) +;
cData
cQuery += cWhere
::oDbfCli:oServer:SqlQuery( cQuery )
::oDbfCli:LoadQuery()
alguma ideia do que possar ser? seguindo os exemplos da própria classe.
Link to comment
Share on other sites

olhando o workbench fiz uma alteração por lá e ele mostra o comando e ficou desta maneira

cQuery := "UPDATE advsys.arqcli SET "
cQuery += "cod=" + ClipValue2SQL( ::oDbfCli:cod ) + ","
cQuery += "nom=" + ClipValue2SQL( ::oDbfCli:nom ) + ","
cQuery += "cgc=" + ClipValue2SQL( ::oDbfCli:cgc ) + ","
cQuery += "alterar=" + ClipValue2SQL( ::oDbfCli:alterar ) + ","
cQuery += "usuario=" + ClipValue2SQL( ::oDbfCli:usuario ) + " WHERE "
cWhere := "sql_rowid=" + ALLTRIM(STR(::oDbfCli:Recno()))
agora resta saber se estou no caminho certo, a minha dúvida é em relação a rede, se está correto usar desta maneira.
Link to comment
Share on other sites

Fala ae Ale...

// No inicio de cada Módulo crio o a minha query
D_SetCaseSensitive( .T. )
oQry = oServer:Query( "SELECT * FROM aliquota Order by nomori" )
// Depois defino se irei Incluir (lAppend=.T.) ou se irei Alterar (lAppend=.F.)
// Carrega as variaveis de memória
IF !lAppend
CUFORI := oQry:UFORI
CNOMORI := oQry:NOMORI
CUFDEST := oQry:UFDEST
CNOMDEST := oQry:NOMDEST
CALIQ := oQry:ALIQ
CINDEXUF := oQry:INDEXUF
wRowId := oQry:sql_rowid
ELSE
CUFORI := "SP"
CUFDEST := "SP"
CNOMORI := "SAO PAULO"
CNOMDEST := "SAO PAULO"
CALIQ := 0
CINDEXUF := "SPSP"
ENDIF
// Na gravação é assim que faço
IF lAppend
CINDEXUF := cufori+cufdest
cCmdSql:= "INSERT INTO aliquota (ufori,nomori,ufdest,nomdest,aliq,indexuf) VALUES('"+cUFORI+"','"+cNOMORI+"','"+cUFDEST+"','"+cNOMDEST+"',"+str(cAliq) +",'"+cINDEXUF+"')"
oServer:Execute( cCmdSql )
IF ! oServer:lError
BEEP()
MSGRUN(OemToAnsi("Registros inclusos com Sucesso..."),OemToAnsi("ATENۂO..."))
ELSE
BEEP()
MSGRUN(OemToAnsi("Nao foi possivel Incluir os Registros..."),OemToAnsi("ATENۂO..."))
AchaErro(_cCmdSql)
ENDIF
ELSE
CINDEXUF := cufori+cufdest
cCmdSql:= "UPDATE aliquota SET aliq="+str(cAliq)+", nomori='"+CNOMORI+"', nomdest='"+CNOMDEST+"', ufori='"+CUFORI+"', ufdest='"+CUFDEST+"' where Sql_RowId="+str (wRowId)+""
oServer:Execute( cCmdSql )
IF ! oServer:lError
BEEP()
MSGRUN(OemToAnsi("Registros atualizado com Sucesso..."),OemToAnsi("ATENۂO..."))
ELSE
MSGRUN(OemToAnsi("Nao foi possivel Alterar os Registros..."),OemToAnsi("ATENۂO..."))
AchaErro(_cCmdSql)
ENDIF
ENDIF
ENDIF
oQry:Refresh()
oBrw:REFRESH()
oDlg:UPDATE()
Link to comment
Share on other sites

Olá Kleyber, o tipo do campo é

type : bigint

charset : binary

display size : 10,3

Flw amigo alviverde. eu também estarei usando desta maneira, a diferença é que irei usar a própria classe que tem o lappend. ai já tiro uma variavel de controle, rsrsrsrsrs para ter mais controle. rsrsrsrsrsrsrs

agradecido ao dois...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...