Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 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
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Jan 2004
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..


  •  

    Posting Permissions

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