Hi,
I have an C# winforms app that works fine on all our XP machines. We want to put it on a new Win 2008 64 bit server and it breaks on the following code:
using (OdbcConnection oConn = new OdbcConnection())
{
oConn.ConnectionString = @"Driver={Microsoft dBase Driver (*.dbf)};SourceType=DBF;SourceDB=" + filePath + ";Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;";
oConn.Open();
OdbcCommand oCmd = oConn.CreateCommand();
oCmd.CommandText = "SELECT DISTINCT Mid(POSTCODE,1,Len(POSTCODE)-2) AS sector FROM " + shortfilename + ".dbf;";
OdbcDataReader dr = oCmd.ExecuteReader();
try
{
while (dr.Read())
{
lstSectors.Items.Add(dr.GetString(0));
}
}
catch
{
string err = "Error!";
}
finally { dr.Close(); }
}
The error I get is:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
If I look at the 64 bit ODBC Data Source Admin, there are no dBASE drivers there - but in the 32 bit (C:\Windows\SysWOW64\odbcad32.exe), they are - how do I get the application to use the 32 bit drivers?
Many thanks