|
-
Sep 6th, 2004, 03:15 AM
#1
Thread Starter
Junior Member
Connecting Oracle DB
I am trying to connect to an oracle database from Excel VBA. I have oracle ODBC connection to the oracle database: ABC
The code look like this(but don't work):
Dim oCn1 As ADODB.Connection
Dim oRs1 As ADODB.Recordset
Dim connection1 As String
Dim szSQL As String
connection1 = "Provider=MSDAORA.1;" & _
"Password=PW;" & _
"User ID=UI;" & _
"Data Source=ABC"
Set oCn1 = New ADODB.Connection
oCn1.Open connection1
szSQL = "SELECT * FROM Table; "
Set oRs1 = New ADODB.Recordset
oRs1.Open szSQL, connection1, adOpenForwardOnly, adLockReadOnly, adCmdText
When I debug it fails on the oRs1.Open, I get the message: "Identifier is too long", thers something wrong with the connection1 String but I dont know what.
Does anyone know what might be the problem.
/Bjso
-
Sep 7th, 2004, 04:21 AM
#2
Addicted Member
u have to write:
VB Code:
Set oRs1 = New ADODB.Recordset
oRs1.Open szSQL, oCn1, adOpenForwardOnly, adLockReadOnly, adCmdText
the connection is oCn1 n not the connection string
-
Sep 7th, 2004, 04:54 AM
#3
Thread Starter
Junior Member
My misstake, but I still get error message: "Invalid Caracter"
I think there is someting with the ODBC connection.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|