Partager via


CDatabase::CommitTrans

Call this member function upon completing transactions.

BOOL CommitTrans( );

Return Value

Nonzero if the updates were successfully committed; otherwise 0. If CommitTrans fails, the state of the data source is undefined. You must check the data to determine its state.

Remarks

A transaction consists of a series of calls to the AddNew, Edit, Delete, and Update member functions of a CRecordset object that began with a call to the BeginTrans member function. CommitTrans commits the transaction. By default, updates are committed immediately; calling BeginTrans causes commitment of updates to be delayed until CommitTrans is called.

Until you call CommitTrans to end a transaction, you can call the Rollback member function to abort the transaction and leave the data source in its original state. To begin a new transaction, call BeginTrans again.

For more information about transactions, see the article Transaction (ODBC).

Example

See the article Transaction: Performing a Transaction in a Recordset (ODBC).

Requirements

Header: afxdb.h

See Also

Concepts

CDatabase Class

CDatabase Members

Hierarchy Chart

CDatabase::BeginTrans

CDatabase::Rollback