PRB: BatchOptimistic with Client-Side Cursor in DataEnvironment Fails (288928)
The information in this article applies to:
- Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP4
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
This article was previously published under Q288928 SYMPTOMS
When you set a recordset to use client-side cursor and the BatchOptimistic lock type, there is no update to the database until you call the UpdateBatch method. However, if the DataGrid is bound to the DataEnvironment object, it does not work as expected. Any update to the DataGrid sends to the database immediately without the UpdateBatch method being called even if you have set the command's properties accordingly.
CAUSE
The problem is caused by the Microsoft Environment Instance 1.0 component (Msderun.dll), which does not handle such situations correctly. The problem only occurs on Msderun.dll version 6.0.88.4 that is shipped with Microsoft Visual Studio 6.0 Service Pack 4 (SP4). The problem does not occur on Msderun.dll version 6.0.0.3005 that is shipped with Visual Studio 6.0) or version 6.0.84.50 that is shipped with Visual Studio 6.0 Service Pack 3 (SP3).
RESOLUTION
One workaround is to use Microsoft ADO Data Control (ADODC) or ActiveX Data Object ADO) recordset object as the data source of the DataGrid instead of using the DataEnvironment and command, as follows:
- Create a new Visual Basic project, add the DataGrid control, and then add an ADO Data Control, ADODC1.
- Configure the ADO Data Control to use the Microsoft Jet 4.0 OLE DB Provider, and choose the Nwind.mdb database file. (The database file is shipped with Visual Basic 6.0, and the typical directory is C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB.)
- Set the LockType property of ADODC1 to 4-adLockBatchOptimistic.
- On the newly added ADO Data Control, click the RecordSource tab of Property Pages, and then choose Products Table.
- Configure the DataGrid control's DataSource to adodc1.
- Run the project.
- Modify the value in the cell of the first row, second column (ProductName).
- Click another cell in the DataGrid, and note that
the change is not updated to the database without calling the UpdateBatch method.NOTE: Verify the change by rerunning the program.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 6/25/2004 |
---|
Keywords: | kbBug kbDatabase kbDataBinding kbDataEnv kbpending kbprb KB288928 |
---|
|