Updates to the data source are managed during transactions through the use of an edit buffer (the same method used outside of transactions). The field data members of a recordset collectively serve as an edit buffer that contains the current record, which the recordset backs up temporarily during an AddNew or Edit. During a Delete operation, the current record is not backed up within a transaction. For more information about the edit buffer and how updates store the current record, see Recordset: How Recordsets Update Records (ODBC).
Note If you have implemented bulk row fetching, you cannot call AddNew, Edit, or Delete. You must instead write your own functions to perform updates to the data source. For more information about bulk row fetching, see Recordset: Fetching Records in Bulk (ODBC).
During transactions, AddNew, Edit, and Delete operations can be committed or rolled back. The effects of CommitTrans and Rollback might cause the current record to not be restored to the edit buffer. To make sure that the current record is properly restored, it is important to understand how the CommitTrans and Rollback member functions of CDatabase work with the update functions of CRecordset.
The Edit Buffer
Recordset: How Recordsets Update Records (ODBC)
This topic applies to the MFC ODBC classes.
Besides their ability to select records from a data source, recordsets can (optionally) update or delete the selected records or add new records. Three factors determine a recordset's updateability: whether the connected data source is updateable, the options you specify when you create a recordset object, and the SQL that is created.
Note The SQL on which your CRecordset object is based can affect your recordset's updateability. For example, if your SQL contains a join or a GROUP BY clause, MFC sets the updateability to FALSE.Note This topic applies to objects derived from CRecordset in which bulk row fetching has not been implemented. If you are using bulk row fetching, see Recordset: Fetching Records in Bulk (ODBC).
This topic explains:
Your role in recordset updating and what the framework does for you.
The recordset as an edit buffer and the differences between dynasets and snapshots.
Recordset: How AddNew, Edit, and Delete Work (ODBC) describes the actions of these functions from the point of view of the recordset.
Recordset: More About Updates (ODBC) completes the recordset update story by explaining how transactions affect updates, how closing a recordset or scrolling affects updates in progress, and how your updates interact with the updates of other users.