Partager via


CDaoWorkspace::CommitTrans

Call this member function to commit a transaction — save a group of edits and updates to one or more databases in the workspace.

void CommitTrans( );

Remarks

A transaction consists of a series of changes to the database's data or its structure, beginning with a call to BeginTrans. When you complete the transaction, either commit it or roll it back (cancel the changes) with Rollback. By default, without transactions, updates to records are committed immediately. Calling BeginTrans causes commitment of updates to be delayed until you call CommitTrans.

Avertissement

Within one workspace, transactions are always global to the workspace and are not limited to only one database or recordset. If you perform operations on more than one database or recordset within a workspace transaction, CommitTrans commits all pending updates, and Rollback restores all operations on those databases and recordsets.

When you close a database or workspace with pending transactions, the transactions are all rolled back.

Notes

This is not a two-phase commit mechanism. If one update fails to commit, others still will commit.

Requirements

Header: afxdao.h

See Also

Concepts

CDaoWorkspace Class

CDaoWorkspace Members

Hierarchy Chart