Download Database - National Instruments

Transcript
Chapter 5
SQL Toolkit Library Reference — DBCommit
DBCommit
int status = DBCommit (int connectionHandle);
Purpose
Commits all changes that you make using the SQL statements INSERT, UPDATE, or DELETE
during a call to DBBeginTran. You must call DBBeginTran to begin a transaction before you
can call DBCommit to save all changes.
Parameter
Input
Name
connectionHandle
Type
Description
integer
Handle to the database connection that
DBConnect or DBNewConnection returns.
Return Value
Name
status
Type
Description
integer
Result code that DBCommit returns.
DBCommit returns the set of result codes
listed in the function description for
DBError.
Example
hdbc = DBConnect("DSN=QESS;UID=shawkins;SRVR=PENNY");
...
resCode = DBBeginTran(hdbc);
hstmt = DBActivateSQL(hdbc,
"UPDATE EMP SET SALARY = SALARY * 1.1");
resCode = DBDeactivateSQL(hstmt);
resCode = DBCommit(hdbc);
resCode = DBDisconnect(hdbc);
See Also
DBBeginTran, DBRollback
© National Instruments Corporation
5-39
LabWindows/CVI SQL Toolkit Reference Manual