Share via


CDatabase::CommitTrans

BOOLCommitTrans();

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

Call this member function upon completing transactions. 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 in Visual C++ Programmer's Guide.

Example

See the article in Visual C++ Programmer's Guide.

CDatabase OverviewClass MembersHierarchy Chart

See Also   CDatabase::BeginTrans, CDatabase::Rollback