Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRY/CATCH With SQL
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01270081
Message ID:
01270083
Views:
21
This message has been marked as the solution to the initial question of the thread.
You have to check return value from SQLEXEC() and if it less than 0 (-1) use AERROR() to get detailed ODBC error info.

>The following does not trigger the CATCH block when a SQL error occurs.
>oException.ErrorNo = 0 even when a SQL error occurs. What am I doing wrong?
>
>
>oException = CREATEOBJECT("RFException")
>
>TRY
>	SQLEXEC(._iSQLConnHandle, sQuery, sTableName)
>CATCH TO oException
>ENDTRY
>
>IF ._HandleError(oException)
>
>	SQLEXEC(._iSQLConnHandle, "SELECT @@ROWCOUNT AS AffectedRows", "SQLTally")
>	iRowsAffected = SQLTally.AffectedRows
>
>	USE IN SQLTally
>
>ENDIF
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform