dBASE ODBC drivers on Windows Server 2008

血红的双手。 提交于 2020-01-07 06:47:39

问题


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?


回答1:


It is not possible to use a 32-bit ODBC driver from a 64-bit application. 64-bit processes cannot call into 32-bit DLLs (not directly anyway). Microsoft has a KB article about the 64-bit ODBC administrator that might help.



来源:https://stackoverflow.com/questions/2147931/dbase-odbc-drivers-on-windows-server-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!