使用vba进行Oracle数据访问

时间:2012-11-02 15:36:17

标签: excel vba

设置我的con对象时,我一直收到424错误

Dim con As Object
Dim rs As Object
Dim query As String
Set con = CreateObject(ADODB.Connection)
Set rs = CreateObject(ADODB.Recordset)

strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(jdbc:oracle:thin" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=somehost)(PORT=10080))" & _
"(CONNECT_DATA=(SERVICE_NAME=somename))); uid=uid; pwd=pwd;"

任何人都不能让我不知道我做错了什么?

感谢

1 个答案:

答案 0 :(得分:2)

像这样:

Set con = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")