Microsoft KB Archive/281887

= FIX: Invalid Bookmark Error Message Appears When Records Are Added to a Server-Side ADO Recordset =

Article ID: 281887

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft ActiveX Data Objects 2.5

-



This article was previously published under Q281887



SYMPTOMS
If you use a DataGrid to add a record to a server-side ActiveX Data Objects (ADO) recordset, you receive one of the following error messages when there are more records than the DataGrid can display:

Invalid Bookmark

-or-

c0000005 (access violation)



CAUSE
The Invalid Bookmark error message appears if Visual Studio Service Pack 5 (SP5) has not been applied. The access violation error message appears if you have Microsoft Data Access Components (MDAC) 2.6 or MDAC 2.7 installed (without any service pack) on a computer that has Visual Studio Service Pack 5 (SP5) installed.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft Data Access Components (MDAC ) 2.6 or MDAC 2.7. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack

The easiest resolution is to switch to client-side cursors for instances where DataGrids are used to add records to ADO recordsets.



MDAC
This problem was first corrected in MDAC 2.6 Service Pack 1, and MDAC 2.7 Service Pack 1.

Visual Studio 6.0
This bug was corrected in Microsoft Visual Studio 6.0 Service Pack 5 (SP5). 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 the Behavior

 * 1) Create a new Standard EXE in Visual Basic. Form1 is created by default.
 * 2) On the Project menu, choose Components, choose Microsoft ADO Data Control 6.0 and Microsoft DataGrid Control 6.0, and then place an instance of each on the form.
 * 3) Right-click the ADO Data Control and, on General tab, set up a connection string to a SQL Server database.
 * 4) Select the Recordsource tab, select 2-adCmdTable, and then select a table in the database from the drop-down list.
 * 5) On the ADODC1 property sheet, set the CursorLocation property to 2-adUseServer.
 * 6) On the property sheet, select the DataGrid, and then set AllowAddNew to True and DataSource to ADODC1.
 * 7) Run the project and press the PAGE DOWN key until you get to the bottom of the DataGrid.
 * 8) When you get to the last row, click in a field and begin to add a record. When you move off of the newly added field in the new record, you receive one of the two error messages listed in the &quot;Symptoms&quot; section unless Visual Studio SP5 has been applied on a computer that is running MDAC 2.5.

