尝试使用visual Basic将mysql数据库连接到excel工作表

hgc7kmma  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(220)

我觉得这是一个简单的问题,但我似乎无法解决它。我正在尝试在我的excel工作表和mysql服务器之间建立连接,但不断收到错误“运行时错误”-2147467259(80004005)':
[microsoft][odbc driver manager]找不到数据源名称,未指定默认驱动程序“我已安装了必要的驱动程序,因此我不确定从何处开始,这是我迄今为止的代码

Dim conn As New ADODB.Connection
Dim TableName As String
Dim sqlstr As String
Dim rs As ADODB.Recordset

Dim CRow As Long, Trow As Long
Dim Column1 As Integer, Column2 As Integer

Set conn = New ADODB.Connection

conn.Open ("DRIVER = {MySQL ODBC 5.3 Unicode Driver}" _
& ";SERVER=127.0.0.1" _
& ";DATABASE=tmi_stock" _
& ";UID=root" _
& ";PWD=MyRoot2018")

Set rs = New ADODB.Recordset

sqlstr = "INSERT INTO tester VALUE(1, 2)"
rs.Open sqlstr, conn, adOpenStatic

Set rs = Nothing
conn.Close
Set conn = Nothing

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题