FIX: AutoNumber Field Is Not Incremented When Using ADO
Jan.01, 2010 in
data access
Symptoms
When using the ODBC, Microsoft Access, or SQL Server OLE DB Providers thefollowing may appear:
A “0″ displays in the AutoNumber (or Identity) field after addingrecords through the DataGrid control bound to an ActiveX Data Objects(ADO) Data ControlA “0″ is stored in the AutoNumber (or Identity) field after addingrecords to a recordset, using the AddNew method of the recordset. This only occurs when the CursorLocation is set to “3″ – adUseClient.
Resolution
By using the client-side cursors, the OLE DB provider is unable to requerythe server for the updated record, and a “0″ appears in place of thecorrect value. When you requery the recordset, the correct value appears.

Leave a Reply