cComandoSQLComando SQL enviado ao banco de dados por meio do DBAccess/TopConn.
AdvPL GuideTCSqlExec( <cComandoSQL> ) --> nRetExecutes an SQL command directly through TopConn/DBAccess.
TCSqlExec() runs SQL commands that do not return a query cursor, such as controlled update or maintenance statements. It should be used carefully because it bypasses part of the usual Protheus business-routine safeguards.
TCSqlExec( <cComandoSQL> ) --> nRetcComandoSQLComando SQL enviado ao banco de dados por meio do DBAccess/TopConn.
Numérico. Retorna o código de execução informado pela camada TopConn/DBAccess; valide o comportamento no ambiente e versão utilizados.
#Include "TOTVS.ch"
User Function ExTCSqlExec()
Local cSql := "UPDATE " + RetSqlName("SA1") + " SET A1_XOBS = 'OK' WHERE D_E_L_E_T_ = ' ' AND A1_COD = '000001'"
Local nReturn := TCSqlExec(cSql)
MsgInfo("SQL return: " + CValToChar(nReturn))
ReturnRuns an UPDATE restricted by key and shows the return code. Use only as a didactic example and validate in a test environment.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.