whats better loop in recordset or

Results 1 to 4 of 4

Thread: whats better loop in recordset or

  1. #1
    perform Guest

    Default whats better loop in recordset or

    1)I&#039m wondering whats better. Open recordset loop data into array and then another to process data. Or process data while in recordset loop?<BR>2)Once I do the rs.Open can i give it many sql strings? Do i have to do a sql, sql2, sql3 or what?

  2. #2
    Join Date
    Dec 1969

    Default RE: whats better loop in recordset or

    1. YOu dont need to loop through the recordset to fill an array. You can use the getrows method<BR>yourArray = rs.getrows(). Yes in many cases this is faster. Especially if you have alot of records to go through. Make sure in your select statements you only specify the fields you need. <BR>YOu could also speed it up by referencing the value in the recordset by its index and not the name... like this<BR>rs(0) or rs(5)<BR><BR>Im pretty sure you have to close a recordset before you can call another sql statement. You may want to check microsoft docs for some information on that though.

  3. #3
    Join Date
    Dec 1969

    Default RE: whats better loop in recordset or

    If you can process the data through your first iteration of the loop, do that. If you need to step through the results of a Recordset numerous times, dump it into an array using GetRows<BR><BR>More info on GetRows can be seen at the following two articles:<BR><BR>Paging Records with GetRows<BR>http://www.4guysfromrolla.com/webtech/070500-1.shtml<BR><BR>Using GetRows to Speed Up Displaying Skinny Tables<BR>http://www.4guysfromrolla.com/webtech/tips/t053100-1.shtml<BR><BR>Happy Programming!

  4. #4
    Rafeeq Guest

    Default RE: whats better loop in recordset or

    Yup. GetRows method is much faster and it retriews the recordset in an 2X2 array. You can pass as many as SQl statements for the same recordset object. All you gotta do is close the recordset which ensures that all the system resources holding the recordset are freed however the recordset object will still be in the memory and you can query a new SQL.

Posting Permissions

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