Web Analytics Made Easy -
StatCounter How to count the number of rows in a RecordSet??? - CodingForum

Announcement

Collapse
No announcement yet.

How to count the number of rows in a RecordSet???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to count the number of rows in a RecordSet???

    HI all, Im now doing a system using ASP.

    But right now, Im implementing VBScript to access the database. Im using MS Access.

    Ive been having problems trying to get the number of rows of the recordset.

    For example, I need to know the number of orders the same person made for a certain month...

    So i guess the SQL Statement would be

    set rs = Select count(*) from Expenses where id = id and MONTH(date) = 11

    How do i get the number of rows in 'rs' ? Can i? If not is there any alternatives to get the row count from the database?

    Any help would be appreciated..Thanks

  • #2
    A query like that returns a recordset with one record that has one field (the count).
    So I think rs.fields(0).value or rs(0) will work. But if it doesn't, you could always use "as" in the sql statement to give the field a name: select count(*) as num_orders from ..... Then you could definitely use rs("num_orders").

    shmoove

    Comment


    • #3
      Yea baby...thanks alot... That is going to be so useful...I was still thinking like mad on how to do it...haa thanks again..

      Comment

      Working...
      X