Recordset: Adding Records in Bulk (ODBC)
This topic applies to the MFC ODBC classes.
The MFC CRecordset class has a new optimization that improves efficiency when you are adding new records in bulk to a table.
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).
A new option for the dwOptions parameter to the CRecordset::Open member function, optimizeBulkAdd
, improves performance when you are adding multiple records consecutively without calling Requery
or Close
. Only those fields that are dirty before the first Update
call are marked as dirty for subsequent AddNew
/Update
calls.
If you are using the database classes to take advantage of the ::SQLSetPos
ODBC API function for adding, editing, and deleting records, this optimization is unnecessary.
If the ODBC Cursor Library is loaded or the ODBC driver does not support adding, editing, and deleting through ::SQLSetPos
, this optimization should improve bulk add performance. To turn on this optimization, set the dwOptions parameter in the Open
call for your recordset to the following:
appendOnly | optimizeBulkAdd
See also
Recordset (ODBC)
Recordset: Adding, Updating, and Deleting Records (ODBC)
Recordset: Locking Records (ODBC)