Cicode Programming Reference > Cicode Function Categories > SQL Functions Introduction > SQLRollBack

SQLRollBack

Rolls back (discards) all changes made to the database within the current transaction. If you call the SQLBeginTrans() function to begin a transaction, you are not committed to changes to the database made by the Insert, Delete, and Update commands until you call the SQLCommit() function. You can discard these changes by calling the SQLRollBack() function.

You can only call the SQLRollBack() function if you have called SQLBeginTran() to begin a transaction. You do not need to begin a transaction to modify a database, but any changes you make to a database outside of a transaction are automatically committed.

The SQLRollBack() function could affect different databases in different ways. If the function is not performing as you expect, check that your database is ODBC-compatible. Refer to the documentation for your database for more information on rolling back transactions.

Syntax

SQLRollBack(hSQL)

hSQL:

The handle to the SQL connection, returned from the SQLConnect() function. The SQL connection handle identifies the table where details of the associated SQL connection are stored.

Return Value

0 (zero) if successful, otherwise an error number is returned. (For details of the 307 error code, call the SQLErrMsg function).

Related Functions

SQLBeginTran, SQLCommit, SQLConnect, SQLDisconnect, SQLEnd, SQLErrMsg, SQLExec, SQLFieldInfo, SQLGetField, SQLInfo, SQLNext, SQLNoFields, SQLNumChange, SQLTraceOff, SQLTraceOn

Example

See SQLBeginTran

See Also

SQL Functions