我有一个VBA项目,它连接到Oracle DB并运行一些SQL查询。现在,代码在Windows 7机器中运行顺畅,但在Windows 10中没有。我的连接字符串如下:
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sConnString As String
sConnString = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=" & "localhost" & ")(PORT=" & "19005" & "))" & _
"(CONNECT_DATA=(SERVICE_NAME=" & "XXXXXXXX" & "))); uid=" & username & " ;pwd=" & pwd & ";"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open sConnString
我附上了使用Excel 2016在Winidows 10中运行时收到的错误消息的屏幕截图。
代码是在Windows 7机器的Excel 2013中编写的。对此有何解决方案?