PRB: CRecordset::Move(0) Asserts with skipDeletedRecords OptionLast reviewed: August 7, 1997Article ID: Q165606 |
The information in this article applies to:
SYMPTOMSWhen you open a CRecordset with the skipDeletedRecords option set, it's Move() member function asserts if the nRows parameter is 0.
CAUSEThe reason for this behavior is to prevent the refresh of rows that are deleted by other client applications using the same data. Since no scroll direction is specified by a Move(0) call, it is not possible to determine which record to skip to if the current record was deleted. A Move(0) on a deleted row would have an ambiguous outcome. To prevent the possibility of doing a Move() to a deleted record, Move(0) is not allowed when the skipDeletedRecords option is set.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorThe following code reproduces this:
CMyRecordset RSet ; RSet.Open (AFX_DB_USE_DEFAULT_TYPE, NULL, CRecordset::skipDeletedRecords) ; RSet.Move (0) ;The Move(0) call results in an assertion. Move(0) refreshes the recordset data for the current row from the open database cursor. This is useful in a multi-user environment when the recordset is opened using the dyanset or dynamic open types. Other users may change the database after the current row has been retrieved. Move(0) refreshes the recordset row data so that it reflects the current contents of the database. If it is necessary to use Move (0), open the recordset without the skipDeletedRecords option. Another effect of the Move() function is that it switches out of Edit/Add New mode. To prevent this from happening, use the CancelUpdate() member function. This refreshes the row data from the local cache without hitting the database cursor. Keywords : MfcDatabase kbusage Version : 4.2 4.2b 5.0 Platform : NT WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |