K
khchrist
Hello
I tried it for 2 days and read a lot of messages, but I can't find it out what's wrong with the following code.
I want to open a dBase file via Microsoft odbc.
The connection goes on without error message, but at the line
daDBF.Fill(dsFBF,"TABLE1")
the programm crashed with the error message "Systemerror"
error in Microsoft.data.Odbc.dll.
What's wrong ?
I installed all the drivers again.
The same Code with OleDb Works !
Thanks
Karl-Heinz
private void btnDBFodbc_Click(object sender, System.EventArgs e) {
System.Data.DataSet dsDBF;
string cSQLStmtDBF = @"select * from hotel";
string connStrDBF = @"Driver={Microsoft dBase Driver (*.dbf)};Initial Catalog='D:\iscralo'";
Microsoft.Data.Odbc.OdbcConnection connDBF = new Microsoft.Data.Odbc.OdbcConnection(connStrDBF);
connDBF.Open();
Microsoft.Data.Odbc.OdbcDataAdapter daDBF = new Microsoft.Data.Odbc.OdbcDataAdapter();
daDBF.SelectCommand = new Microsoft.Data.Odbc.OdbcCommand (cSQLStmtDBF,connDBF);
dsDBF = new DataSet() ;
try {
daDBF.Fill(dsDBF,"TABLE1");
connDBF.Close();
dataGrid1.SetDataBinding(dsDBF,"TABLE1");
}
catch(System.Data.Odbc.OdbcException ex) {
MessageBox.Show(ex.Message);
}
}
I tried it for 2 days and read a lot of messages, but I can't find it out what's wrong with the following code.
I want to open a dBase file via Microsoft odbc.
The connection goes on without error message, but at the line
daDBF.Fill(dsFBF,"TABLE1")
the programm crashed with the error message "Systemerror"
error in Microsoft.data.Odbc.dll.
What's wrong ?
I installed all the drivers again.
The same Code with OleDb Works !
Thanks
Karl-Heinz
private void btnDBFodbc_Click(object sender, System.EventArgs e) {
System.Data.DataSet dsDBF;
string cSQLStmtDBF = @"select * from hotel";
string connStrDBF = @"Driver={Microsoft dBase Driver (*.dbf)};Initial Catalog='D:\iscralo'";
Microsoft.Data.Odbc.OdbcConnection connDBF = new Microsoft.Data.Odbc.OdbcConnection(connStrDBF);
connDBF.Open();
Microsoft.Data.Odbc.OdbcDataAdapter daDBF = new Microsoft.Data.Odbc.OdbcDataAdapter();
daDBF.SelectCommand = new Microsoft.Data.Odbc.OdbcCommand (cSQLStmtDBF,connDBF);
dsDBF = new DataSet() ;
try {
daDBF.Fill(dsDBF,"TABLE1");
connDBF.Close();
dataGrid1.SetDataBinding(dsDBF,"TABLE1");
}
catch(System.Data.Odbc.OdbcException ex) {
MessageBox.Show(ex.Message);
}
}