我是 vba 的新手,希望能帮助我使用 VBA 连接到 Oracle SQL。我有这样的 MS Server 代码,需要以某种方式修改它(或创建一个新代码),以便它与 Oracle SQL 一起使用。
这是代码:
Public Const sConnect As String = "xxx; Initial Catalog=xxx; User ID=xxx;Password=xxx;"
Sub GetData1()
Sheets(1).Range("a1:ao20000").ClearContents
Dim rsConnection As ADODB.Connection
Dim rsRecordset As ADODB.Recordset
Dim sQuerry As String
sQuerry = "select * from xxx"
Set rsConnection = New ADODB.Connection
Set rsRecordset = New ADODB.Recordset
rsConnection.ConnectionString = sConnect
rsConnection.Open
Set rsRecordset = rsConnection.Execute(sQuerry)
Worksheets(1).Range("A2").CopyFromRecordset rsRecordset
rsConnection.Close
Set rsConnection = Nothing
Set rsRecordset = Nothing
End Sub
我的问题是:除了 Oracle Developer,我还需要安装什么吗?如果是这样,是什么?如何更改代码以使其工作?
非常感谢提前!!问候, Maciej