Cannot Get Datagrid to Bind to Dataset
Hi all,
I'm having a real hard time getting data from an Access database to be displayed in a datagrid in a webform.
Here is my code:
VB Code:
DataGrid1.DataSource = DS.Tables(0).DefaultView
DataGrid1.DataBind()
MyDataAdapter.Dispose()
MyConnection.Dispose()
I've tried not calling the .Dispose methods at the end, but doesn't make a difference.
I know this shouldn't be hard, but for some reason, it's not working.
Prior to this code, I do a response.write (ds.tables(0).Rows.Count) and I get > 0, so it's getting something.
Does anyone have any suggestions?
Thanks in advance.
JB
Re: Cannot Get Datagrid to Bind to Dataset
Hello
I'm programming ASP.net since a few weeks, so I'm new.. But why not use the SqlDataSource? It works fine for me..
You bound the SqlDataSource to the gridview..
You can edit the query that fills the SqlDataSource whenever you want..
greetz
nickname