CDatabase::Rollback

Call this member function to reverse the changes made during a transaction.

BOOL Rollback( );

Return Value

Nonzero if the transaction was successfully reversed; otherwise 0. If a Rollback call fails, the data source and transaction states are undefined. If Rollback returns 0, you must check the data source to determine its state.

Remarks

All CRecordset AddNew, Edit, Delete, and Update calls executed since the last BeginTrans are rolled back to the state that existed at the time of that call.

After a call to Rollback, the transaction is over, and you must call BeginTrans again for another transaction. The record that was current before you called BeginTrans becomes the current record again after Rollback.

After a rollback, the record that was current before the rollback remains current. For details about the state of the recordset and the data source after a rollback, see the article Transaction (ODBC).

Example

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

Requirements

Header: afxdb.h

See Also

Reference

CDatabase Class

Hierarchy Chart

CDatabase::BeginTrans

CDatabase::CommitTrans

Other Resources

CDatabase Members