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);
}

}

Re: ODBC connection dataset Dbase by khchrist

khchrist
Mon May 30 18:37:18 CDT 2005

Hello
I tried also the connection string

string connStrDBF = @"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\iscralo";

without success

Karl-Heinz


Re: ODBC connection dataset Dbase by Paul

Paul
Tue May 31 09:34:56 CDT 2005

On Mon, 30 May 2005 23:37:18 GMT, khchrist <christ2@tin.it> wrote:

¤ Hello
¤ I tried also the connection string
¤
¤ string connStrDBF = @"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\iscralo";
¤
¤ without success
¤
¤ Karl-Heinz

I don't see any problem with the syntax. I would just make certain the dBase driver is installed and
the dBase filename is eight characters or less (not counting the extension).


Paul
~~~~
Microsoft MVP (Visual Basic)

Re: ODBC connection dataset Dbase by khchrist

khchrist
Tue May 31 12:56:22 CDT 2005

Hello Paul
I think the driver is installed. The connection to the dbase-file seems is stabilized.
But it crashes when I want to fill the dataset.

in the ODBC Data Souce Administrator is listed the MS Driver with the file ODBCJT32.dll from 19.03.2003 V4.00.6200.00

Any other idea?


Karl-Heinz

On Tue, 31 May 2005 09:34:56 -0500, Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:

>On Mon, 30 May 2005 23:37:18 GMT, khchrist <christ2@tin.it> wrote:
>
>¤ Hello
>¤ I tried also the connection string

>¤ string connStrDBF = @"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\iscralo";

>¤ without success

>¤ Karl-Heinz
>
>I don't see any problem with the syntax. I would just make certain the dBase driver is installed and
>the dBase filename is eight characters or less (not counting the extension).
>
>
>Paul
>~~~~
>Microsoft MVP (Visual Basic)


Re: ODBC connection dataset Dbase by Paul

Paul
Tue May 31 14:31:55 CDT 2005

On Tue, 31 May 2005 17:56:22 GMT, khchrist <christ2@tin.it> wrote:

¤ Hello Paul
¤ I think the driver is installed. The connection to the dbase-file seems is stabilized.
¤ But it crashes when I want to fill the dataset.
¤
¤ in the ODBC Data Souce Administrator is listed the MS Driver with the file ODBCJT32.dll from 19.03.2003 V4.00.6200.00
¤
¤ Any other idea?
¤

Not for ODBC. Microsoft typically recommends using OLEDB since it's a bit more stable than ODBC.


Paul
~~~~
Microsoft MVP (Visual Basic)

RE: ODBC connection dataset Dbase by VijayPoteMCPMCADMCSDInDotNet

VijayPoteMCPMCADMCSDInDotNet
Thu Aug 04 14:16:02 CDT 2005

Hi Christ,

try the same with creating a DSN through ODBC, it will solve the problem.

Vijay Pote
Vijay Pote (MCP, MCAD, MCSD-In Dot Net)

"khchrist" wrote:

> 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);
> }
>
> }
>