datagrid
I populate a datagrid in a windows form with the following code:
OleDbDataAdapter da = new OleDbDataAdapter("select * from " + this.tableSelected, this.myConn);
DataSet ds = new DataSet();
da.Fill(ds, this.tableSelected);
this.dataGrid.DataSource = ds.DefaultViewManager;
when the database is loaded, a listbox displays all of the tables. when a table is clicked, the tableSelected variable is populated and this code is called to populate the datagrid with data from this particular table.
anyway, the issue i have is that when a table is selected, the data is not shown initially.
all that is shown is a grey box with 2 rows and 1 column, the bottom box has an arrow
and a plus sign enclosed ina box. clicking this plus sign then displays the table name into a
white box to its right. i must then click this table name to show the data inside the dataset within the datagrid.
how can i get this data to display without having to click the table name since it already knows the name of the table when the code gets here?
thanks
Replies
Know the answer? Post it — somebody with the same question will find it here.