aferra Posted May 25, 2016 Report Share Posted May 25, 2016 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. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 25, 2016 Report Share Posted May 25, 2016 http://forums.fivetechsupport.com/viewtopic.php?f=3&t=30552&start=0 Quote Link to comment Share on other sites More sharing options...
aferra Posted May 25, 2016 Author Report Share Posted May 25, 2016 no caso não tenho campo memo....mas irei testar o Val2Escape( var ) Quote Link to comment Share on other sites More sharing options...
aferra Posted May 25, 2016 Author Report Share Posted May 25, 2016 bem pode ser campos nulos...como configurar para não ficar nulos? Quote Link to comment Share on other sites More sharing options...
aferra Posted May 25, 2016 Author Report Share Posted May 25, 2016 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. Quote Link to comment Share on other sites More sharing options...
kleyber Posted May 25, 2016 Report Share Posted May 25, 2016 Aferra, Qual o tipo de dados do campo SQL_ROWID ? Quote Link to comment Share on other sites More sharing options...
Valdir Posted May 25, 2016 Report Share Posted May 25, 2016 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() Quote Link to comment Share on other sites More sharing options...
aferra Posted May 27, 2016 Author Report Share Posted May 27, 2016 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... Quote Link to comment Share on other sites More sharing options...
kleyber Posted May 29, 2016 Report Share Posted May 29, 2016 Aferra, Se o campo é bigint, então não há a necessidade de se transformar com o STR no WHERE... Não sei se isso vai solucionar teu caso, mas é só uma observação. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.