CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Recordset Class - memory usage and speed

    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 :-)

  2. #2
    Join Date
    Dec 1999
    Location
    Slovakia
    Posts
    26

    Re: Recordset Class - memory usage and speed

    Fast methods to get value

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




    [ufo]

  3. #3
    Join Date
    Dec 1999
    Posts
    5

    Re: Recordset Class - memory usage and speed

    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


  4. #4
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Re: Recordset Class - memory usage and speed

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

  5. #5
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Recordset Class - memory usage and speed

    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 :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured