Recordset: Adding Records in Bulk (ODBC)
| Overview | How Do I | FAQ | Sample | | ODBC Driver List
This article applies to the MFC ODBC classes. For DAO recordsets, see the article DAO Recordset.
The MFC class has a new optimization (in both 16- and 32-bit versions) that improves efficiency when you’re adding new records in bulk to a table.
****Note ****This article applies to objects derived from CRecordset in which bulk row fetching has not been implemented. If you are using bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).
A new option for the dwOptions parameter to the member function, optimizeBulkAdd, improves performance when you’re adding multiple records consecutively without calling Requery or Close. Only those fields that are “dirty” prior to 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 doesn’t support adding, editing, and deleting via ::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 :
appendOnly | optimizeBulkAdd
See Also Recordset: Adding, Updating, and Deleting Records (ODBC), Recordset: Locking Records (ODBC)