Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Which is Preferred

This is a discussion on Which is Preferred within the ASP forums, part of the Programming Talk category; I was counting the records in my recordset. For doing this there are various ways. I tried with both count() ...

  1. #1
    Adrian is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124

    Question Which is Preferred

    I was counting the records in my recordset. For doing this there are various ways. I tried with both count() and also by using a variable and incremented the variable inside the recordset as the pointer moves on each recordset. Though both fetched the same result my query is whether there is any difference in performance between the two approach and which one is preferred than other. Kindly also state the reason for the same which would help me to get a better idea.


  2. #2
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97
    Definitely your first method of using count () is preferred when compared with the other method of using a variable and incremented the variable inside the recordset as the pointer moves on each recordset. This is because the database activity involved with the latter method is much and when you use this in a situation of having number of users with numerous records definitely there would be decrease in performance due to increase in database activity. Also in addition your recordset would be actively kept until you finish the whole process. So comparing all this the best preferred method out of the two suggested is the use of count ().


Latest Article

Network Security Risk Assessment and Measurement

Read More...