我正在尝试使用Oracle db在excel中运行vba脚本。当我尝试建立一个conn时,它会显示一些错误,如:
Connection Error
Import failed: 3706 - Provider cannot be found. it may not be installed properly.
我知道有很多Q& A与此相关,但我找不到任何有用的答案。请帮帮我。
答案 0 :(得分:0)
请查看此代码
Sub Oracle_Connection_VBA()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim query As String
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
'Replace below with the corresponding values
strcon = "Provider=MSDAORA;Data Source=[Your Database];Persist Security Info=True;User ID=[DB username];Password=[DbPassword]"
con.Open (strcon)
'do
con.Close
End Sub