Microsoft KB Archive/223082

= FIX: DataGrid Error Deleting Last Row from OSP Provider Data =

Article ID: 223082

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft ActiveX Data Objects 1.5
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1

-



This article was previously published under Q223082



SYMPTOMS
If an OLE DB Simple Provider (OSP) is the bound DataSource for a Data Grid and an attempt is made to delete all the rows in the Data Grid, the following error is generated on the deletion of the last row:

Microsoft DataGrid Control: Error occurred while trying to delete record.



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 Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

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

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
 Obtain the following two files from the Data Access SDK:

- ospsampb.dll

- sampleosp_vb.reg

NOTE: The Data Access SDK can be downloaded from the following location:

http://msdn2.microsoft.com/en-us/data/aa937695.aspx) Use Regsvr32 to register the ospsampb.dll. Double-click the sampleops_vb.reg file to properly register ospsampb.dll as a OLE DB Simple Provider. Start Visual Basic 6.0 and create a Standard EXE project. Form1 is created by default. Set the following project references:

- Microsoft ActiveX Data Objects

- Microsoft Data Adapter Library

- Sample OLE DB Simple Provider (Visual Basic 98)

 Add the following control to the default form and set its AllowDelete property to True:

- Microsoft DataGrid Control (OLE DB)

</li>  Paste the following code into the default form: Dim da As New DataAdapter Dim ds As New MyDataSource

Set da.Object = ds DataGrid1.DataMember = App.Path & "\Customer.txt" Set DataGrid1.DataSource = da                   </li> Save the project.</li> Paste the following text into Notepad.exe:

5;2

CustomerID;CompanyName;

WANDK;Die Wandernde Kuh;

WARTH;Wartian Herkku;

WELLI;Wellington Importadora;

WHITC;White Clover Markets;

WILMK;Wilman Kala;

</li> Save the file as "Customer.txt" in the same directory as the Visual Basic project created above.</li> Run the Project, click on a row's Row-Indicator (the left-most column) to select the entire row, and press the DELETE key to delete the row.</li> Repeat the step above for each row in the grid.</li></ol>

Keywords: kbbug kbctrl kbdatabinding kbfix kbmdacnosweep kbnoupdate kbvs600sp3fix KB223082

-

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

© Microsoft Corporation. All rights reserved.