Microsoft KB Archive/165606

= PRB: CRecordset::Move(0) Asserts with skipDeletedRecords Option =

Article ID: 165606

Article Last Modified on 12/10/2003

-

APPLIES TO


 * Microsoft Visual C++ 4.2 Enterprise Edition
 * Microsoft Visual C++ 4.2 Enterprise Edition
 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q165606



SYMPTOMS
When you open a CRecordset with the skipDeletedRecords option set, it's Move member function asserts if the nRows parameter is 0.



CAUSE
The 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.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
The 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.

Additional query words: kbvc420 kbvc500 kbvc600

Keywords: kbdatabase kbprb kbusage KB165606

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.