Bucky
Well-known member
Wow, its been a long time since Ive visited this forum. Im having some trouble filling an empty DataSet from an Access database. Heres the code (I intentionally changed the path in the connection string):
GetSql() returns a valid SQL string (I tested it out in Access), and a DataTable is created in the DataSet with the correct columns, but no rows are added to it. adapter.Fill() returns 0, and data.Tables[0].Rows.Count is also 0. There should be 1000+ records in there.
What could be wrong?
Thanks.
C#:
private DataSet GetData() {
OleDbConnection connection = new OleDbConnection(@"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=Data path here;Provider=Microsoft.Jet.OLEDB.4.0;");
OleDbDataAdapter adapter = new OleDbDataAdapter(GetSql(), connection);
DataSet data = new DataSet();
connection.Open();
adapter.Fill(data);
connection.Close();
return data;
}
GetSql() returns a valid SQL string (I tested it out in Access), and a DataTable is created in the DataSet with the correct columns, but no rows are added to it. adapter.Fill() returns 0, and data.Tables[0].Rows.Count is also 0. There should be 1000+ records in there.
What could be wrong?
Thanks.