The information in this article applies to:
SUMMARY
You can use CDaoRecordset to insert, update, or delete records in a table
in a Microsoft SQL Server 6.0 database. There are two ways to do it:
-or- MORE INFORMATIONUsing a Direct ODBC Connection in CDaoDatabase::Open()If you create a DAO dynaset without specifying a unique index on one or more fields in the recordset and then try updating or adding a record, MFC DAO will throw an exception and you will see the following errors in the MFC Trace output:AddNew fails with this message: Edit() fails with a similar message:
Using a Linked Table Through a Microsoft Access 7 DatabaseIf you create a DAO dynaset on a linked table in Microsoft Access, the recordset becomes read only if there is no unique identifier specified in Microsoft Access and there is no unique index on some field(s) in the recordset. You will see the same error messages from AddNew or Edit as shown in the previous case.One way to satisfy the requirement for a unique index is to create an index on the primary key. Note that if you use the PRIMARY KEY specification new to SQL Server version 6.0 when creating your tables, you will automatically generate a unique index on the primary key. This syntax is demonstrated here:
Additional query words: kbinf 4.00
Keywords : kbDAO kbDatabase kbMFC kbVC |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |