I'm connecting to a Microsoft Access database using the following code:
Expand|Select|Wrap|Line Numbers
- OleDbConnection conn = new OleDbConnection(
- @"Provider=Microsoft.Jet.OLEDB.4.0; " +
- @"Data Source=C:\Bob\Status\Timekeeping Status Sheets\Timekeeping.mdb");
- conn.Open();
- System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(
- "select charge, description from timesheet", conn);
- DataTable t = new DataTable();
- dataGridView1.DataSource = t;
I've tried creating a binding source and setting its DataSource to "t", and setting the dataGridView's data source to the binding source, to no avail. Still nothing happens.
I've verified that the data table has data in it by manually populating a ListBox with the data read from the database. That part works. Getting the data in the datagrid does not work. Any clues, help or pointers would be appreciated. Thanks.