The information in this article applies to:
SYMPTOMSYou may continue to see deleted records when using the CRecordset and CRecordView classes with a snapshot recordset. CAUSEThe default behavior of the MFC ODBC classes has changed. It is now possible to move onto a record that has been deleted. If the current record has been deleted, the CRecordset IsDeleted() function will return TRUE. RESOLUTIONOpen your CRecordset using the skipDeletedRecords option, or check IsDeleted() to ensure that the current record is valid before using it. STATUSThis behavior is by design. MORE INFORMATIONThe default behavior of a snapshot no longer skips deleted records. CRecordView opens a CRecordset with the default behavior so the CRecordView will display deleted records. An example of this behavior appears in the Enroll tutorial. If you delete the last record in the CSectionSet recordset, the deleted record will continue to be displayed in the CSectionForm record view. If you try to delete this record again, you will receive the following error message:
Sample Code
REFERENCESSee the documentation for CRecordset::Open() and CRecordset::IsDeleted(), as well as the MFC 4.2 Encyclopedia articles entitled "Recordset: How Addnew, Edit, and Delete Work" and "Recordset: Adding, Updating, and Deleting Records" Additional query words: Move MoveFirst MoveLast MoveNext MovePrev kbvc420 kbvc500 kbvc600
Keywords : kbprg kbDatabase kbMFC kbODBC kbVC |
Last Reviewed: July 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |