Child list exception

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I'm trying to connect "DataGridView" to ".MDB" file
from the code:

string connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\file.MDB";

OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();

DataGridView1.DataSource = connection.DataSource;
DataGridView1.DataMember = "tblTime;

When execution get to the line:
"DataGridView1.DataMember = "tblTime".ToString(); "

There is exception:

"Child list for field tblTime cannot be created."


Does somebody know what i'm doing wrong ?

thank you,
dave
 
dave,

The problem here is that you are trying to set the data source to the
connection. You can't do this. You have to assign a connection to a
dataadapter and then fill a dataset with that information. Then, you can
bind the data grid to the data set.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top