Record counting in a database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jasone
    New Member
    • Mar 2007
    • 66

    #1

    Record counting in a database

    Hey all,

    i need to do a number of record counts on one table, for value matching a certain criteria,

    to do for this page i have no database connection, recordset etc, i am a little confused where to start.

    so basically i have a table of flights... and i want to show a table in asp stating that there are so many flights to london, so many flight to cardiff and so on...

    please help!
  • jasone
    New Member
    • Mar 2007
    • 66

    #2
    problem solved... used this nice bit of code, to select what i want to count

    Code:
    <% 
    Dim cn,cm 
    Set cn = Server.CreateObject("ADODB.Connection") 
    cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("airlines.mdb") 
    set rs2=cn.execute ("Select count(*) as cardiffflights from tbl_flight_details WHERE arriving_airport ='cardiff'") 
    set rs=cn.execute ("Select count(*) as total from tbl_flight_details") 
    response.write "There are " & rs2("cardiffflights") & " flights landing in cardiff"
    response.write "There are " & rs("total") & " flights arriving"
    cn.close 
    Set cn = Nothing 
    Set rs = Nothing 
    %>

    Comment

    Working...