迁移 VB6 代码以使用 64 位 ODBC DSN [英] Migrating VB6 code to use 64-bit ODBC DSN

查看:24
本文介绍了迁移 VB6 代码以使用 64 位 ODBC DSN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的 VB6 应用程序,它使用 ODBC 与专有的 3rd 方数据库建立 ODBC 连接.

I have a legacy VB6 application, which is making ODBC connections to a proprietory 3rd party database using ODBC.

Dim con As Object '  New ADODB.Connection
Set con = CreateObject("ADODB.Connection")
con.Open ("DB64bitDSN")

它过去一直有效.最近他们安装了 64 位版本的 3rd 方数据库.3rd 方数据库在安装过程中会自动创建一个 64 位的 ODBC DSN,当我使用 Excel 的数据连接向导进行连接并使用 ODBC DSN 作为数据源时也是如此.

It used to work until now. Recently they have installed 64 bit version of the 3rd party database. The 3rd party database automatically creates a 64 bit ODBC DSN during installation, and the same is working when I connect using Excel's Data Connection Wizard, and using ODBC DSN as the data source.

但是我的代码出错了:

错误描述:[Microsoft][ODBC 驱动程序管理器] 指定的 DSN 包含驱动程序和应用程序之间的架构不匹配

Error Description: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

错误来源:Microsoft OLE DB Provider for ODBC Drivers

Error Source: Microsoft OLE DB Provider for ODBC Drivers

我应该如何更改我的代码以使其工作?我是否需要添加对任何库的引用并修改我的代码?

How should I change my code to make it work? Do I need to add a reference to any library and modify my code?

谢谢.

推荐答案

您不需要更改代码.您需要询问他们"来创建 32 位 ODBC DSN.VB6 需要这个才能连接.

You do not need to change the code. You need to ask "them" to create a 32-bit ODBC DSN. VB6 requires this in order to connect.

有关此 Microsoft 页面的更多信息.

从页面中提取

在 64 位下管理连接到 32 位驱动程序的数据源平台,使用 c:\windows\sysWOW64\odbcad32.exe.

To manage a data source that connects to a 32-bit driver under 64-bit platform, use c:\windows\sysWOW64\odbcad32.exe.

这篇关于迁移 VB6 代码以使用 64 位 ODBC DSN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆