Click to See Complete Forum and Search --> : Recordset Class - memory usage and speed


Crazy D @ Work
December 29th, 1999, 06:30 AM
Hi,
I'm doubting to create a general recordset class which automatically sets some properties (so that I don't have to set the active connection, cursor type, etc.).
Now I'm wondering... what's the most efficient way according to speed and memory:
use the ADODB.Recordset and forget the class (hehe that's the easiest :-)
or, create a property which wants a fieldname as argument, and get that field from the recordset and return it as Variant,
or, return a Recordset so I can use it in the program like ClassName.PropertyName!MyField
I'm especially intrested in the last 2 options :-)
Which one is the cheapest according to memory (less memory usuage) and is the fastest? Looking up the field (PropName = rst.Fields(psFieldName) ) or returning the recordset?
Tnx! :-)


Crazy D @ Work :-)

ufo
December 29th, 1999, 07:05 AM
Fast methods to get value

variable = rs.get_Collect(1).Value
variable = rs(1)
variable = rs.Field(1)




[ufo]

fgingras
December 29th, 1999, 12:55 PM
I don't know about memory usage but as for speed I tried both methods you describe and went with the Recorset!Field.

As I'm sure you know, the class method is structurally better but if you need fast data access the easy way (Recorset!Field) is faster in this case.

Francis Gingras

valkyrie
December 30th, 1999, 12:50 AM
Kudos to fgingras!!
I agree, it is certainly faster to use
rst!Field, especially if you have to do it in a loop or something.

Have a great Millenium!

____________________________________
The VB Bugs in my Life...

Crazy D @ Work
December 30th, 1999, 02:01 AM
Hi,
Recordset!Field may be some faster, but using a class is easier (at least in my case) and for most of the tables I need to access speed doesn't matter, so I'll write the class, and in the few cases speed is really important, I'll use a recordset :-)
Tnx!

Crazy D @ Work :-)