Microsoft KB Archive/252756

From BetaArchive Wiki

Article ID: 252756

Article Last Modified on 8/23/2001



APPLIES TO

  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q252756

SYMPTOMS

Changing any of the layout properties of the ADO DataGrid Control at design time may cause the grid to not appear properly at run time. Instead of showing the correct data, the grid will appear with two columns and the correct number of rows and the cells that appear will be empty.

This also occurs when changing the number of splits at design time.

RESOLUTION

To resolve this problem, after editing the DataGrid Control, right click it and select Clear Fields or Retrieve Fields. This will allow the DataGrid to show the data in the correct number of columns at run-time.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Standard EXE in Visual Basic.
  2. Click References on the Project menu and select ActiveX Data Objects Library 2.1.
  3. Click Components on the Project menu and select Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB).
  4. Place an ADO Data Control (Adodc1) on Form1 and set the following properties:

    ConnectionString: Enter a valid Northwind connection
    CursorLocation: adUseClient
    RecordSource: SELECT * FROM Employees

  5. Place a DataGrid (DataGrid1) on the form and set the following properties:

    DataSource: Adodc1

  6. Right-click DataGrid1 and select Edit from the pop-up menu that appears. Then again right-click DataGrid1 and select Split from the pop-up menu.
  7. Run the code. Both splits on the DataGrid will display with two columns and nine rows. The cells will be empty.
  8. Quit the application and right-click DataGrid at design time. Select Clear fields from the pop-up menu. Now the data should display correctly at run time.


Keywords: kbdatabinding kbdatabase kbprb kbmdacnosweep KB252756