Reputation: 493
I am using a datagrid in my VB 6 application. I have a recordset, which is having records. Now i assign this recordset to my datagrid in the form, yet the datagrid is not displaying any data. Any help will be much appreciated. Thankx in advance.
Upvotes: 0
Views: 7052
Reputation: 61
The first thing to check is that you have the columns of the DataGrid configured correctly to match your recordset.
You can set the DataSource of the DataGrid either at design time to a DataEnvironment or at runtime. I'm presuming based on your question that you are setting the DataSource at runtime to an ADODB recordset?
Set myDataGrid.DataSource = someRecordSet
In order to display the data in your recordset properly you need to configure the columns of your DataGrid. To do this right click the grid at design time and select the edit option as shown below.
Right click the grid again and click the either insert/delete/append options from the context menu until you have the correct number of columns that you want to display.
Once you've added the columns right click the grid again, select Properties and go to the Columns tab as shown below.
For each column you've defined you need to enter a caption to display as the column header and also the DataField name from you recordset that should be shown in this column.
Once you've done this the data from your recordset should display properly. Note that you need to open the recordset with a bookmarkable cursor type (adOpenKeyset, adOpenStatic) or you will receive a run time error when you launch the application.
Upvotes: 1