Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default ADO slow recordset getrows

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ADO slow recordset getrows

RB,

Without knowing anything about the system architecture
involved one thing you may try is:

rs.CursorLocation = adUseClient

This caches the recordset rows on your local machine
instead of the database server. If the database you are
connecting to is remote, this could save many roundtrips
to the server.

Another thing to try is:

rs.LockType = adLockOptimistic

This tells the provider (database) to not lock records
unless an Update is called. But you aren't updating
records since

rs.CursorType = adForwardOnly and that is not an
updatable recordset cursor type.

Setting rs.LockType = adLockReadOnly may cause the
provider to place read-only locks on each row of the
result set. This could have a performance impact
depending on whether the provider does row-level or table-
level locking and/or if there are other processes
attempting to operate on the same tables.

Good Luck,

pete...


-----Original 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


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
query a recordset SAm Excel Discussion (Misc queries) 2 May 1st 07 09:33 PM
pivot table from recordset - very slow performance [email protected] Charts and Charting in Excel 1 May 14th 06 04:05 PM
return recordset Laurent M Excel Discussion (Misc queries) 4 January 26th 05 09:43 AM
ADODB Recordset Seth[_3_] Excel Programming 0 August 5th 03 02:15 PM
Default recordset type? -\) Excel Programming 3 July 23rd 03 09:16 AM


All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"