Reputation: 23
My code:
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString ="Driver={Microsoft dBASE Driver (*.dbf)};Driverid=277;Dbq=D:\\DBF\\";
conn.Open();
OdbcCommand oCmd = conn.CreateCommand();
DataTable dt = new DataTable();
dt.Load(oCmd.ExecuteReader());
conn.Close();
dataGridView1.DataSource = dt;
When I run to oCmd.ExecuteReader() then error: ERROR [HY000] [Microsoft][ODBC dBase Driver] External table is not in the expected format.
Upvotes: 0
Views: 1463
Reputation: 1086
You just showed your connection where your DBF file is, but didn't specified any commandText
, Try something like that
oCmd.CommandText = "SELECT * FROM TableName";
Upvotes: 1