JavaScript Editor js editor     Web development 



Main Page

Commits a transaction.

SQLCOMMIT(nStatementHandle)

Parameters

nStatementHandle


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

Return Value

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

Remarks

If manual transactions are in effect (the SQLSETPROP(В ) Transactions property is set to Manual), you can send multiple updates to remote tables and commit all the updates with SQLCOMMIT(В ).

Updates can be rolled back with SQLROLLBACK(В ).

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), allowing you to use SQLCOMMIT(В ) and SQLROLLBACK(В ).

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

В Copy Code
= SQLSETPROP(gnHandle, 'Transactions', 2)  && Manual transactions
= SQLEXEC(gnHandle, "INSERT INTO authors (au_id, au_lname);
   VALUES ('aupoe', 'Poe')")  && Modify the authors table
= SQLCOMMIT(gnHandle)  && Commit the changes

See Also



JavaScript Editor js editor     Web development