DBF Import Crashes .NET APP and no error log whatsoever

H

Henok Girma

Hello,
I have the following code to connect and query a dbf file.

string cnn = @"Driver={Microsoft dBASE Driver
(*.dbf)};DriverID=277;Dbq=C:\DBF;exclusive=yes";
OdbcConnection odbcCnn = new OdbcConnection(cnn);
odbcCnn.Open();
OdbcCommand odbcCmd = odbcCnn.CreateCommand();
odbcCmd.CommandText = @"SELECT * FROM C:\DBF\Users.DBF";
OdbcDataReader reader =odbcCmd.ExecuteReader();
..
..
..
but at this point, the .net application crashes. I have the code surrounded
by try{} catch{} and even then the whole app crashes, there is no error
generated, no message, just the application vanishes. I'm at loss as to how
to troubleshoot this.

the same code works fine on my dev machine, but on some machine, I believe 2
separate machines, I have experienced what I just described.

where can i look for logged errors. does the .net framework log when .net
apps crash? there is no log in the windows event logs.

any help is greatly appreciated.
 
P

Paul Clement

¤ Hello,
¤ I have the following code to connect and query a dbf file.
¤
¤ string cnn = @"Driver={Microsoft dBASE Driver
¤ (*.dbf)};DriverID=277;Dbq=C:\DBF;exclusive=yes";
¤ OdbcConnection odbcCnn = new OdbcConnection(cnn);
¤ odbcCnn.Open();
¤ OdbcCommand odbcCmd = odbcCnn.CreateCommand();
¤ odbcCmd.CommandText = @"SELECT * FROM C:\DBF\Users.DBF";
¤ OdbcDataReader reader =odbcCmd.ExecuteReader();
¤ .
¤ .
¤ .
¤ but at this point, the .net application crashes. I have the code surrounded
¤ by try{} catch{} and even then the whole app crashes, there is no error
¤ generated, no message, just the application vanishes. I'm at loss as to how
¤ to troubleshoot this.
¤
¤ the same code works fine on my dev machine, but on some machine, I believe 2
¤ separate machines, I have experienced what I just described.
¤
¤ where can i look for logged errors. does the .net framework log when .net
¤ apps crash? there is no log in the windows event logs.
¤
¤ any help is greatly appreciated.

Have you tried using Jet OLEDB and the dBase ISAM driver instead of the ODBC driver?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
J

John Saunders [MVP]

Henok Girma said:
Hello,
I have the following code to connect and query a dbf file.

string cnn = @"Driver={Microsoft dBASE Driver
(*.dbf)};DriverID=277;Dbq=C:\DBF;exclusive=yes";
OdbcConnection odbcCnn = new OdbcConnection(cnn);
odbcCnn.Open();
OdbcCommand odbcCmd = odbcCnn.CreateCommand();
odbcCmd.CommandText = @"SELECT * FROM C:\DBF\Users.DBF";
OdbcDataReader reader =odbcCmd.ExecuteReader();
.
.
.
but at this point, the .net application crashes. I have the code
surrounded
by try{} catch{} and even then the whole app crashes, there is no error
generated, no message, just the application vanishes. I'm at loss as to
how
to troubleshoot this.

the same code works fine on my dev machine, but on some machine, I believe
2
separate machines, I have experienced what I just described.

where can i look for logged errors. does the .net framework log when .net
apps crash? there is no log in the windows event logs.

any help is greatly appreciated.

Please try surrounding the code with the following:

try
{
// Your code here
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
catch
{
Console.WriteLine("Unmanaged exception thrown!");
}
 

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

Top