Microsoft KB Archive/223082

From BetaArchive Wiki

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


MORE INFORMATION

Steps to Reproduce Behavior

  1. 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)
  2. Use Regsvr32 to register the ospsampb.dll.
  3. Double-click the sampleops_vb.reg file to properly register ospsampb.dll as a OLE DB Simple Provider.
  4. Start Visual Basic 6.0 and create a Standard EXE project. Form1 is created by default.
  5. Set the following project references:

    - Microsoft ActiveX Data Objects

    - Microsoft Data Adapter Library

    - Sample OLE DB Simple Provider (Visual Basic 98)

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

    - Microsoft DataGrid Control (OLE DB)

  7. 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
                        
  8. Save the project.
  9. 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;

  10. Save the file as "Customer.txt" in the same directory as the Visual Basic project created above.
  11. 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.
  12. Repeat the step above for each row in the grid.


Keywords: kbbug kbctrl kbdatabinding kbfix kbmdacnosweep kbnoupdate kbvs600sp3fix KB223082