Difference between revisions of "SQLCOMMIT()"

From Lianjapedia
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
==See Also==
 
==See Also==
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]] [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
+
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]] [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]], [[SQLTRANSACTION()]]
  
 
==Description==
 
==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 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 ODBC connection specified by <nStatementHandle>.
  
{| class="wikitable" width=100%
+
{| class="wikitable" width="100%"
!width=30%|Keywords||width=70%|Description
+
!width="30%"|Keywords||width="70%"|Description
 
|-
 
|-
|nStatementHandle||The workarea in which the gateway data source is open
+
|nStatementHandle||Statement handle to the connection
 
|-
 
|-
 
|}
 
|}
Line 43: Line 43:
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Remote Data Connectivity Functions]]
 
 
[[Category:ODBC Functions]]
 
[[Category:ODBC Functions]]
 
[[Category:SQL Functions]]
 
[[Category:SQL Functions]]

Latest revision as of 09:57, 4 February 2013

Purpose

Commit a transaction

Syntax

SQLCOMMIT(<nStatementHandle>)

See Also

SQLCANCEL(), SQLCOLUMNS(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP() SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES(), SQLTRANSACTION()

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 ODBC connection specified by <nStatementHandle>.

Keywords Description
nStatementHandle Statement handle to the connection

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