JavaScript Editor js editor     Web development 



Main Page

Cancels any changes made during the current transaction.

SQLROLLBACK(nStatementHandle)

Parameters

nStatementHandle


Specifies the statement handle to the data source returned by SQLCONNECT(В ).

Return Value

Numeric. SQLROLLBACK(В ) returns 1 if the transaction is successfully rolled back; otherwise, it returns -1. If SQLROLLBACK(В ) returns -1, you can use AERROR(В ) to determine why the transaction could not be rolled back.

Remarks

If manual transactions are in effect (the SQLSETPROP(В ) transaction property is set to manual), you can send multiple updates to remote tables. The updates can all be rolled back with SQLROLLBACK(В ).

Updates can be committed with SQLCOMMIT(В ).

Example

The following example assumes SQLCONNECT(В ) is successfully issued, and its return value is stored to a memory variable named gnHandle. SQLSETPROP(В ) is used to set the Transactions property to 2 (manual), making it possible for you to use SQLCOMMIT(В ) and SQLROLLBACK(В ).

The authors table is modified with SQLEXEC(В ), and the changes to the table are cancelled with SQLROLLBACK(В ).

В Copy Code
= SQLSETPROP(gnHandle, 'Transactions', 2)  && manual
= SQLEXEC(gnHandle, "INSERT INTO authors (au_id, au_lname);
   VALUES ('aupoe', 'Poe')")
= SQLROLLBACK(gnHandle)

See Also



JavaScript Editor js editor     Web development