Microsoft KB Archive/223078

From BetaArchive Wiki

Article ID: 223078

Article Last Modified on 10/15/2002



APPLIES TO

  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q223078

SYMPTOMS

The width of a DataGrid column bound to an ADO field of type adBSTR is very narrow under MDAC 2.1 compared to the width of an adBSTR column under MDAC 2.0.

CAUSE

A bug fix in MDAC 2.1 changed the return value for GetColumnInfo calls on columns of type adBSTR. This fix exposed a limitation in the DataGrid control(MSDATGRD.OCX).

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

To create this project, you must have MDAC 2.1 installed.

  1. Start Visual Basic 6.0.
  2. Create a Standard EXE project. Form1 is created by default.
  3. Add the following Project References:

    Microsoft ActiveX Data Objects 2.1 Library

  4. Add the following Project Components:

    Microsoft DataGrid Control 6.0 (OLEDB)

  5. Add the following control to Form1:

    1 - Microsoft DataGrid Control 6.0 (OLEDB)

  6. Paste the following code into Form1's Code Window:

    Private rs As ADODB.Recordset
    
    Private Sub Form_Load()
    
        'Create a new empty recordset with six fields
        Set rs = New ADODB.Recordset
        
        With rs
           .Fields.Append "Column1", adBSTR, 25
           .Fields.Append "Column2", adInteger
           .Fields.Append "Column3", adBSTR, 25
           .Fields.Append "Column4", adVarChar, 25
           .Fields.Append "Column5", adBSTR, 25
           .Fields.Append "Column6", adDBTimeStamp, 25
           .Open
        End With
       
       'Bind the DataGrid to the new empty recordset
        Set Me.DataGrid1.DataSource = rs
    
    End Sub
                        
  7. Run the project. Note the narrow widths of Column1, Column3, and Column5, which display the adBSTR fields.


Keywords: kbbug kbfix kbctrl kbvs600sp3fix KB223078