Newbie : Oracle to Excel Part 2. RDO or ADO?
Hi Rich,
Have a try
Sub test()
Dim connMdb As ADODB.Connection
Dim recMdb As ADODB.Recordset
Dim strStatus As String
Set connMdb = New ADODB.Connection
Set recMdb = New ADODB.Recordset
"open a connection to the DB
connMdb.conn.Open "Provider=MSDAORA;Data Source=theDB", "userID", "password"
recMdb.Open "SELECT [customer id], name FROM customer WHERE state = 'NY' ;",
connMdb, adOpenForwardOnly,
adLockOptimistic
Do while recMdb.EOF = False
debug.print recmdb.fields("customer id").value & " " &
recmdb.fields("name").value
Loop
recMdb.Close
Next cl
connMdb.Close
Set recMdb = Nothing
Set connMdb = Nothing
End Sub
Regards
Jean-Yves
wrote in message
oups.com...
I am using Excel 2002.
Thanks for the previous reply. I wanted to do the following. I wanted
to pass an SQL statement to Oracle. For example, here is a pretend SQL
statement
Select customer id, name from customer table where state = "NY"
Then use RDO or ADO to get the data, and place it into Excel.
How should I do this. Do I still create an ODBC link? Can I still pass
SQL statements using ODBC?
Thanking you all in advance
Rich
..
|