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 4 of 4
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Number of posts in my db?

    Hi,

    I wonder if someone could trll me how to count the amount of posts in my db?
    I got the following code for my db connection:

    Code:
    <%
    Set Connect = Server.CreateObject("ADODB.Connection") 
    Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/db.mdb")
    Set Recset = Connect.execute("SELECT * FROM register ORDER BY namn")
    %>
    PS! I've searched around the forum but didn't find anything that helped me DS!

    /Speedy

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    select count(*) as numberofposts from register

    Returns a recordset wit 1 record and one variable : numberofosts
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Eh? You just made my questionmark even bigger, how do you mean?

    Sorry for being such a n00b

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sql has a serie of so called agregation function. COUNT() is such a funtion. COUNT(*) will count the number of records, and the ' as numberofposts' will just give another name to the variable that contains the count-value.

    you can hen acces it like any other recordset. Only difference is that this one only contains one variable-value pair
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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