Microsoft KB Archive/257707

= FIX: Recordset Not Updated After Invoking the Move Method =

Article ID: 257707

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q257707



SYMPTOMS
When a keyset cursor is being used in a multi-user DataEnvironment, the MoveNext and MovePrevious methods do not appear to update the recordset. If two users change a record, the changes that are made by the first user are not reflected in the second user's view of the data. This behavior occurs when the second user navigates to the updated record by using the MoveNext or MovePrevious methods. This behavior does not occur when the MoveFirst or MoveLast methods are used.



CAUSE
The records are being retrieved from the cache and do not reflect concurrent changes that other users have made to the source data.



RESOLUTION
Change the Cache Size setting of the Command object to 1. (The default value is 100.)



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx



Steps to Reproduce Behavior
 Create a new Data project. DataEnvironment1 and Connection1 are created by default. Configure Connection1 to use OLE DB for SQL server. Click to select the server name and the Pubs database. Add a Command object to the connection. Specify SQL and enter Select * from authors in the SQL window.</li> Locate the Advanced tab. Under Cursor Location, click to select Server-side, under Cursor Type, click to select Keyset, and then under Lock Type, click to select Optimistic.</li> Drag the Command object to the frmDataEnv form (text boxes will be placed on the form).</li> Add four CommandButton controls to the form.</li>  Add the following code to the General Declarations section of Form1: Private Sub Form_Load Command1.Caption = "Move Next" Command2.Caption = "Move Previous" Command3.Caption = "Move First" Command4.Caption = "Move Last" End Sub

Private Sub Command1_Click DataEnvironment1.rsCommand1.MoveNext End Sub

Private Sub Command2_Click DataEnvironment1.rsCommand1.MovePrevious End Sub

Private Sub Command3_Click DataEnvironment1.rsCommand1.MoveFirst End Sub

Private Sub Command4_Click DataEnvironment1.rsCommand1.MoveLast End Sub </li> Save the project with two different names and run both projects, or create an executable and run two instances of it.</li> In the first instance, move to the second record and make a change to a field. Click on Move Next to go to the third record.

In the second instance, click on Move Next to go to the second record and note that the change is visible. This is as expected. Click on Move Previous to move back to the first record.</li> In the first instance, click on Move Previous to go to the second record and make another change. Click on Move Next to go to the third record.

In the second instance, click on Move Next to go to the second record. Note that the second change does not appear. Note also that subsequent changes to any record do not appear. If you use MoveLast or MoveFirst, the records are refreshed and the changes do appear.</li></ol>

Additional query words: sp4

Keywords: kbbug kbdataenv kbfix kbvs600sp4fix kbvs600sp5fix KB257707

-

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

© Microsoft Corporation. All rights reserved.