VBA运行时错误'-2147467259(80004005) [英] VBA Run-time error '-2147467259 (80004005)

查看:7075
本文介绍了VBA运行时错误'-2147467259(80004005)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到 mysql 使用 Excel VBA ,我正在使用Excel 2013.我是新来的VB,所以我按照这个例子:从Excel使用VBA将数据插入MySQL

I am trying to connect to mysql using Excel VBA, I am using Excel 2013. I am new to VB, so i followed this example: Inserting Data Into MySQL From Excel Using VBA

这是我的连接代码:

Private Sub ConnectDB()
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 5.1.13 Driver};" & _
    "SERVER=123.456.0.188;" & _
    "DATABASE=MyDB;" & _
    "USER=MyUser;" & _
    "PASSWORD=MyPassword;" & _
    "Option=3"
End Sub  

当我尝试执行这段代码,我得到以下错误:

When I try to execute this code, I get the following error:

---------------------------
Microsoft Visual Basic for Applications
---------------------------
Run-time error '-2147467259 (80004005)':

Automation error
Unspecified error  

这是我的参考资料:

我知道这个问题可能看起来像一个重复,但我已经看过大部分类似于这个的问题,他们没有解决我的问题。

I know this question may look like a duplicate but I have looked through most of questions similar to this one, they do not solve my issue.

推荐答案

ODBC驱动程序必须匹配VBA应用程序的32或64Bit architekture。

The ODBC drivers must match the 32 or 64Bit architekture of the VBA application.

否则VBA无法使用odbc驱动程序。

Otherwise VBA isn't able to use the odbc drivers.

这篇关于VBA运行时错误'-2147467259(80004005)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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