Difference between revisions of "SQLCOMMIT()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 9: | Line 9: | ||
==Description== | ==Description== | ||
− | The SQLCOMMIT() function is used to commit a transaction. The SQLCOMMIT() function is only required when | + | The SQLCOMMIT() function is used to commit a transaction. The SQLCOMMIT() function is only required when SQLTRANSACTION() is in effect on the connection. |
The SQLCOMMIT() function operates on the data source specified by <nStatementHandle>. | The SQLCOMMIT() function operates on the data source specified by <nStatementHandle>. | ||
− | {| class="wikitable" | + | {| class="wikitable" width=100% |
− | !Keywords||Description | + | !width=30%|Keywords||width=70%|Description |
|- | |- | ||
|nStatementHandle||The workarea in which the gateway data source is open | |nStatementHandle||The workarea in which the gateway data source is open | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
Line 33: | Line 22: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | nStatHand= | + | nStatHand=sqlconnect("awhr") |
if nStatHand < 1 | if nStatHand < 1 | ||
− | + | messagebox("Cannot make connection", 16, "SQL Connect Error") | |
else | else | ||
− | + | messagebox("Connection made", 48, "SQL Connect Message") | |
− | + | sqltransaction(nStatHand) | |
− | + | sqlexec(nStatHand,"insert into dbo.doc1 (account_no, lastname, balance) values ('00889','Brown', 12000)") | |
− | + | if messagebox("Commit Insert?",36,"Transaction") = 6 | |
− | + | sqlcommit(nStatHand) | |
− | + | else | |
− | + | sqlrollback(nStatHand) | |
− | + | endif | |
− | + | sqlexec(nStatHand,"select * from dbo.doc1") | |
− | + | list | |
− | + | sqldisconnect(nStatHand) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
endif | endif | ||
− | |||
</code> | </code> | ||
Revision as of 11:09, 7 January 2013
Contents
Purpose
Commit a transaction
Syntax
SQLCOMMIT(<nStatementHandle>)
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP() SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES()
Description
The SQLCOMMIT() function is used to commit a transaction. The SQLCOMMIT() function is only required when SQLTRANSACTION() is in effect on the connection.
The SQLCOMMIT() function operates on the data source specified by <nStatementHandle>.
Keywords | Description |
---|---|
nStatementHandle | The workarea in which the gateway data source is open |
Example
nStatHand=sqlconnect("awhr") if nStatHand < 1 messagebox("Cannot make connection", 16, "SQL Connect Error") else messagebox("Connection made", 48, "SQL Connect Message") sqltransaction(nStatHand) sqlexec(nStatHand,"insert into dbo.doc1 (account_no, lastname, balance) values ('00889','Brown', 12000)") if messagebox("Commit Insert?",36,"Transaction") = 6 sqlcommit(nStatHand) else sqlrollback(nStatHand) endif sqlexec(nStatHand,"select * from dbo.doc1") list sqldisconnect(nStatHand) endif