Partager via


CDaoWorkspace::Rollback

Call this member function to end the current transaction and restore all databases in the workspace to their condition before the transaction was begun.

void Rollback( );

Remarks

Avertissement

Within one workspace object, 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, Rollback restores all operations on all of those databases and recordsets.

If you close a workspace object without saving or rolling back any pending transactions, the transactions are automatically rolled back. If you call CommitTrans or Rollback without first calling BeginTrans, an error occurs.

Notes

When you begin a transaction, the database engine records its operations in a file kept in the directory specified by the TEMP environment variable on the workstation. If the transaction log file exhausts the available storage on your TEMP drive, the database engine will cause MFC to throw a CDaoException (DAO error 2004). At this point, if you call CommitTrans, an indeterminate number of operations are committed but the remaining uncompleted operations are lost, and the operation has to be restarted. Calling Rollback releases the transaction log and rolls back all operations in the transaction.

Requirements

Header: afxdao.h

See Also

Concepts

CDaoWorkspace Class

CDaoWorkspace Members

Hierarchy Chart

CDaoRecordset Class