DBF Import Crashes .NET APP and no error log whatsoever

  • Thread starter Thread starter Henok Girma
  • Start date Start date
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.
 
¤ 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)
 
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!");
}
 
Back
Top