Re: ADO->Jet, seek method EOF, all subsequent setting the index fa



I think I had tried this method in one of my original attempts, but was
disappointed with the results. I wasn't sure, so I reimplemented using a
command object with a replaceable parameter, and there's too significant of a
performance hit compared to using table direct access with an index on the ID
column.

10,000 lookups using command method: 58.672 seconds
10,000 lookups using table direct method: .719 seconds.

So, as I'd determined, the best performing method available is to open a
table direct recordset into my important table, and use the Index property
and Seek methods to galavant around the table. I still have the issue where
seeking to a record which does not exist (while using a non-primary key
index) puts the cursor at an EndofFile position, and any further setting of
the Index property throws a COM error DB_E_ROWSNOTRELEASED indefinitely.

There isn't much information out there in google land or anywhere else on
this problem, so I'm wondering if I'm pioneering a new method of data access
(not likely), or if there's an easy fix somebody knows about.

- Brett

"Stephen Howe" wrote:

> > I'm using ADO in C++ to access a Jet 4.0 engine Access database. For
> > optimization reasons, we are leaving one main table open at all times,
> since
> > it needs to respond in real time, and opening/closing that table is very
> time
> > consuming.
>
> Is it? I am not sure what you mean by opening/closing a table.
>
> If I was doing this
>
> Looking for single Rows:
> I would setup a Command object with an-adhoc SQL query on the PK and Record
> object.
> This way you don't even have the expense of constructing a Recordset for a
> single row - expensive. Just keep feeding the Command parameter with a new
> parameter and close the Record object when finished. When you have _really_
> finished, destroy Command and Record object.
>
> Looking for multiple Rows:
> I would setup a Command object with an-adhoc SQL query on the PK and
> Recordset object. Just keep feeding the Command parameter with a new
> parameters and close the Recordset object when finished. When you have
> _really_ finished, destroy Command and Recordset object.
> Also consider using record binding - it gains about 10% for big number of
> records
>
> You want to minimise
>
> Command/Record/Recordset creation/destruction
> SQL Query Engine having to reevaluate the query every time round
> The above does just that - you just feed in another parameter every time you
> want more data and reuse existing temporary Stored Procedures, Record and
> Recordset objects.
>
> Stephen Howe
>
>
>
.



Relevant Pages

  • Re: ADO->Jet, seek method EOF, all subsequent setting the index fa
    ... 10,000 lookups using command method: ... table direct recordset into my important table, ... > I would setup a Command object with an-adhoc SQL query on the PK and Record ... > parameters and close the Recordset object when finished. ...
    (microsoft.public.data.ado)
  • Re: File and Folder Listing.
    ... >Dim strPath 'Path of directory to show ... >' A recordset object variable and some selected constants from adovbs.inc. ... >' In order to be able to sort them easily and still close the FSO relatively ...
    (microsoft.public.inetserver.asp.general)
  • Q. Problems with combo box NotInList event
    ... Private Sub Combo133_NotInList ... 'connection and recordset object variables ... 'Dim cn As ADODB.Connection ...
    (microsoft.public.access.formscoding)
  • Re: Run time error 3421
    ... I believe the problem is that your OpenRecordset statement is incorrect. ... recordset is an object variable that represents the Recordset object you ... > Set rstRecords = dbsDatabase.OpenRecordset("SELECT Max ...
    (microsoft.public.access.formscoding)
  • Re: More ASP.Net Newbie Questions
    ... The Command is then what you're doing with this connection, ... In regards to your final point, making grids and controls in general do ... > Connection and Recordset objects into, like, 37 different things. ...
    (microsoft.public.dotnet.framework.aspnet)