View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
R. Choate R. Choate is offline
external usenet poster
 
Posts: 106
Default ADO slow recordset getrows

If you'll tell me what you are trying to do(big picture), I might be able to
give you some helpful info.
--
RMC,CPA

"RB Smissaert" wrote in message
...
Using Excel XP.
Using ADO with ODBC to connect to an Interbase database.
The ODBC driver is the one from EasySoft

The basic code goes like this:

Public ADOConn As ADODB.Connection

Set ADOConn = New ADODB.Connection



Dim rs As ADODB.Recordset
dim testArray as variant

Set rs = New ADODB.Recordset

'any useful properties to set here?
'rs.CursorLocation = adUseServer
'rs.CacheSize = 30

rs.Open Source:=SQLStatement, _
ActiveConnection:=ADOConn, _
CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly, _
Options:=adCmdText

testArray = rs.GetRows


Now the last statement can take a long time.
Strangely this seems to depend on the SQLStatement, but not on the number of
records returned.
So one query can return a large number of records and the rs.GetRows goes
very fast, whereas another SQLStatement returns less records, but rs.GetRows
takes much longer.
Tried all different properties for the recordset, but it doesn't make much
difference.
One problem is that I only can see how many records rs.Open produces after
transferring to an array because rs.RecordCount doesn't work.

Any advice here greatly appreciated.



RBS