VBA ADO Connection to Oracle with Async
- From: "JasonF" <jamf00@xxxxxxxxx>
- Date: 20 Nov 2006 13:18:31 -0800
I've tried this a few different ways, but basically I just want to
connect to an Oracle database, retrieve a sql recordset asynchronously,
and doevents while I'm waiting. Unfortunately, executing the ADODB
command asynchronously takes only a second. When I try to test the
recordset to see if there are existing records, it takes about 20
minutes, the same length of time the sql statement takes to execute
within Oracle SQLPlus.
Am I doing something wrong with my connection, command, or recordset?
How do I make the "execute" method actually execute the sql rather than
just skipping past as it sets up the recordset?
This snippet is not complete, but I think it contains enough to
troubleshoot.
1 Dim cnCIS As New ADODB.Connection
2 Dim cmCIS As New ADODB.Command
3 Dim sConn As String
4 sConn = "Provider=OraOLEDB.Oracle;"
5 sConn = sConn & "User ID=***;Password=***;"
6 sConn = sConn & "Data Source=cisrpt;"
7 sConn = sConn & "FetchSize=100;CacheType=Memory;"
8 cnCIS.Open sConn
9 cmCIS.CommandText = sql
10 cmCIS.CommandType = adCmdText
11 Set rs = cmCIS.Execute(, , adAsyncExecute)
12 Do While (cmCIS.State And adStateExecuting) = adStateExecuting
13 DoEvents
14 Loop
15 If Not rs.EOF Then Range("charges").Value = rs("amount")
16 rs.Close
Line 15 is where my code waits for the database to return the result.
I'm expecting it to execute the sql in line 11 and move on to lines
12-14 while it's waiting for the result.
.
- Follow-Ups:
- Re: VBA ADO Connection to Oracle with Async
- From: Bob Barrows [MVP]
- Re: VBA ADO Connection to Oracle with Async
- Prev by Date: Re: ADO corrupts date time values in where clause
- Next by Date: Re: VBA ADO Connection to Oracle with Async
- Previous by thread: lengthy operation
- Next by thread: Re: VBA ADO Connection to Oracle with Async
- Index(es):
Relevant Pages
|