|
-
Sep 7th, 2004, 02:18 AM
#1
Thread Starter
Junior Member
Connecting to Oracle DB
I am trying to connect to an oracle database from Excel VBA. I have an ODBC connection to the oracle database: ABC. There seem to be soething wrong with that, cause i dont think the code below is wrong(or is it?). Is it possible to do an ODBC connection directly in the code? Help would be really appriciated.
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=PW;" & _
"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
/Bjso
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
|