vba Excel 2010 32 位 windows 7 64 位 odbc- 连接问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12057725/
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:25:12  来源:igfitidea点击:

Excel 2010 32-bit windows 7 64-bit odbc- Connection Issue

sqlexcelvba

提问by fduff

We have a Excel spreadsheet that connects to Sage via a vba odbc connection (Username and Password *'d)

我们有一个 Excel 电子表格,它通过 vba odbc 连接(用户名和密码 *'d)连接到 Sage

Set CN = New ADODB.Connection
With CN
    .Provider = "MSDASQL"
    .ConnectionString = "DSN=SageLine132;UID=******;PWD=******;"
    .CursorLocation = adUseClient
    .Open
End With

This connection works fine on our 32-bit windows xp computers with office 2010, but not on the new windows 7 64-bit computers running office 2010 32-bit.

When I open the odbc32 in the syswow64 folder the system DSN is installed.

Does anyone have any work around for this or a way to connect without accessing the systems DSN (DSN-Less)?

此连接在我们装有 office 2010 的 32 位 windows xp 计算机上运行良好,但在运行 office 2010 32 位的新 windows 7 64 位计算机上则无法正常工作。

当我打开 syswow64 文件夹中的 odbc32 时,系统 DSN 已安装。

有没有人对此有任何解决方法或一种无需访问系统 DSN(无 DSN)即可连接的方法?

回答by fduff

I suspect this has something to do with the executable being stored in syswow32/or syswow64/.

我怀疑这与存储在syswow32/或 中的可执行文件有关syswow64/

I've never used Sage, but I previously had an issue with MyODBC driver on 64b system, the resolution here might help you:

我从未使用过 Sage,但我之前在 64b 系统上遇到过 MyODBC 驱动程序的问题,这里的解决方案可能会对您有所帮助:

for win 64b users (XP, win7), in order to access your MyODBC driver (or any other DB driver), you need to run the Data Sources from %windir%\SysWOW64\odbcad32.exe.

对于 win 64b 用户(XP、win7),为了访问您的 MyODBC 驱动程序(或任何其他数据库驱动程序),您需要从 %windir%\SysWOW64\odbcad32.exe.

enter image description here

在此处输入图片说明

To make the change permanent, you can add a new Data Sources icon in you Control Panel (must do this from the explorer as it will prompt you for confirmation), name it Data Sources x64, and point it to %windir%\SysWOW64\odbcad32.exe

要使更改永久化,您可以在控制面板中添加一个新的数据源图标(必须从资源管理器中执行此操作,因为它会提示您确认),将其命名为数据源 x64,并将其指向 %windir%\SysWOW64\odbcad32.exe

enter image description here

在此处输入图片说明

for the full article, see here.

有关完整文章,请参见此处