cStatementSQL statement for the authorized DBMS/context.
AdvPL GuideTCSqlExec(cStatement) -> nStatusExecutes one SQL statement on the current DBAccess connection.
TCSqlExec returns a negative numeric status on failure; do not treat it as affected-row count. Statements depend on the DBMS. TDN warns that direct SQL does not update DBAccess control fields. The community example updates a custom product field; this page analyzes the pattern without reproducing a master-data update. The uninvoked block only prepares execution. Connection/transaction owners must define SQL and error handling. (Sources: refs. 1–2.)
TCSqlExec(cStatement) -> nStatuscStatementSQL statement for the authorized DBMS/context.
Numeric; negative indicates failure.
#Include "Protheus.ch"
User Function Ed688()
// Do not invoke with external SQL: define a statement in an isolated lab.
Local bExecute := {|cStatement| TCSqlExec(cStatement)}
ConOut(ValType(bExecute))
Return NilCreates block B without SQL execution. During integration check status < 0 and retrieve TCSQLError in the failure context. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 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.