Re: ADO Recordset
- From: Kirk P. <KirkP@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Sep 2007 11:36:04 -0700
I may have spoke too soon. I plugged the string into the ODBC Connect String
box, and it worked the first time. When I saved and closed and re-ran the
query, I'm now getting a "function sequence error".
There has got to be something wrong with the Microsoft ODBC for Oracle
driver, since I can connect to the Oracle database with TOAD and/or MySQL
with no problem.
"Douglas J. Steele" wrote:
You have to loop through the recordset..
rs.Open strSQL, cn
MsgBox rs.RecordCount
Do While Not rs.EOF
MsgBox rs.Fields(0)
rs.MoveNext
Loop
rs.Close
However, if what you've got as the connection string is working for you, you
should be able to use
ODBC;Driver={Microsoft ODBC for Oracle};SERVER=penprd0;uid=myuid;pwd=mypwd;
as the Connect string for your pass-through query. (It has the added benefit
that you won't need a DSN)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Kirk P." <KirkP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:493CB8AA-BBE3-40E9-AF09-E0143BC6F1AD@xxxxxxxxxxxxxxxx
I'm retrieving records from a back end Oracle database. Normally I set up
a
DSN and use the Microsoft Oracle ODBC driver and get what I need via a
pass
through query. For whatever reason, setting up this DSN isn't working, so
I'm pursuing another option.
This code gets me into the Oracle database (the number of records returned
is correct), but how do I get it to actually display the records in a
query?
Sub ConnectTest2()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM ec_currencies"
cn.CursorLocation = adUseClient
cn.Open "Driver={Microsoft ODBC for Oracle}; " & _
"SERVER=penprd01; uid=myuid;pwd=mypwd;"
rs.Open strSQL, cn
MsgBox rs.RecordCount
rs.Close
cn.Close
End Sub
- Follow-Ups:
- Re: ADO Recordset
- From: Douglas J. Steele
- Re: ADO Recordset
- References:
- Re: ADO Recordset
- From: Douglas J. Steele
- Re: ADO Recordset
- Prev by Date: Re: Changing Combobox to text box
- Next by Date: Re: ADO Recordset
- Previous by thread: Re: ADO Recordset
- Next by thread: Re: ADO Recordset
- Index(es):
Relevant Pages
|