|
各位好,小弟在excel编程连接mysql数据库时报错误,大家能否帮忙分析一下
代码:
Public Sub Get_Source()
Dim conn As ADODB.Connection
Dim rs2 As Object
Dim server_name As String
Dim database_name As String
Dim user_id As String
Dim password As String
Dim strsqlstatus As String
Set conn = New ADODB.Connection
Set rs2 = New ADODB.Recordset
server_name = "10.9.44.240"
database_name = "jiradb"
user_id = "jirauser"
password = "123456"
conn.Open "DRIVER={MySQL ODBC 5.3 ANSI Driver};SERVER=10.9.44.240;DATABASE=jiradb;UID=jirauser;PWD=123456;OPTION=3;"
strsqlstatus = "select * from jiraissue"
With rs2
.Open strsqlstatus, conn
Worksheets("Sheet10").Range("a1").Offset(1, 0).CopyFromRecordset rs2
End With
Set rs2 = Nothing
conn.Close
Set conn = Nothing
End Sub
步调的时候在
conn.Open "DRIVER={MySQL ODBC 5.3 ANSI Driver};SERVER=10.9.44.240;DATABASE=jiradb;UID=jirauser;PWD=123456;OPTION=3;" 报错
我的驱动源配置是这样的
,先谢过大家了!
|
|