vba 为什么在迁移到 Windows 7 时 Excel 找不到我的系统 DSN?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12532836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 17:48:57  来源:igfitidea点击:

Why is Excel not finding my system DSN when moving to Windows 7?

excelwindows-7excel-vbaodbcvba

提问by n8gard

I have a VBA Excel workbook (2007) that works fine on my Windows XP 32-bit machine. It uses ODBC to connect to PostgreSQL via a system DSN. I recently moved to a 64-bit Windows 7 machine and installed drivers and built the system DSN the exact same yet I am not connecting.

我有一个 VBA Excel 工作簿 (2007),可以在我的 Windows XP 32 位机器上正常工作。它使用 ODBC 通过系统 DSN 连接到 PostgreSQL。我最近搬到了一台 64 位的 Windows 7 机器上并安装了驱动程序并构建了完全相同的系统 DSN,但我没有连接。

I see lots of references to building DSNs with the 32-bit ODBC tool and I think I have done that. Any thoughts?

我看到很多关于使用 32 位 ODBC 工具构建 DSN 的参考资料,我想我已经做到了。有什么想法吗?

回答by JMK

You are using the 64 bit ODBC connector with (I'm presuming) 32 bit Office.

您正在将 64 位 ODBC 连接器与(我假设)32 位 Office 一起使用。

Use the ODBC connector at C:\Windows\SysWOW64\odbcad32.exeinstead of the one inside your control panel to setup the System DSN and it will work. You will need to right click and select Run as Administrator.

使用 ODBC 连接器C:\Windows\SysWOW64\odbcad32.exe而不是控制面板内的连接器来设置系统 DSN,它将起作用。您需要右键单击并选择Run as Administrator