Click or drag to resize

SqlCommit Function

X#
Commits a transaction.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION SqlCommit(
	nStatementHandle AS LONG
) AS LONG
Request Example View Source

Parameters

nStatementHandle
Type: Long
Specifies the statement handle to the data source returned by SqlConnect( ).

Return Value

Type: Long
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( ).
Examples
X#
1= SqlSetProp(gnHandle, 'Transactions', 2)  // Manual transactions
2= SqlExec(gnHandle, "Insert Into authors (au_id, au_lname);
3VALUES ('aupoe', 'Poe')")  // Modify the authors table
4= SqlCommit(gnHandle)  // Commit the changes
See Also