Windows Server 2008上的dBASE ODBC驱动程序 [英] dBASE ODBC drivers on Windows Server 2008
问题描述
我有一个C#winforms应用程序,可以在我们所有的XP计算机上正常运行.我们希望将其放在新的Win 2008 64位服务器上,并在以下代码上中断:
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(); }
}
我得到的错误是:
错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
如果我查看64位ODBC数据源管理,那里没有dBASE驱动程序-但是在32位(C:\ Windows \ SysWOW64 \ odbcad32.exe)中,它们是-我如何将应用程序获取到使用32位驱动程序?
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?
推荐答案
无法从64位应用程序中使用32位ODBC驱动程序. 64位进程无法调用32位DLL(无论如何都不能直接调用). Microsoft有一个有关 64位ODBC管理员的知识库文章,可能会有所帮助.
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.
这篇关于Windows Server 2008上的dBASE ODBC驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!