Build information on ASP page from DB

Discussion in 'ASP.NET / ASP.NET Core' started by BigZAJ, Dec 29, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a db to track a bunch of stats that are all text values. I have say workorder# and techname in the table.

    How can I compile the total number of workorders say TECH-A did? In SQL to choose then it would be:

    SELECT survey.workorder# FROM survey WHERE survey.techname = 'TECH-A'

    this would return all of the workorders TECH-A did, how can I count them and keep it in a variable to say like TECH-A did 55% of all workorders? If I need to do this in javascript, I guess I would loop through while !EOF but how would close the ASP stuff to call a jscript function that uses an ASP variable/value?

    'Initialise the strSQL variable with an SQL statement to query the database
    code:

    strSQL = 'SELECT survey.workorder_no FROM survey WHERE survey.techname = 'TECH-A;'

    'Open the recordset with the SQL query
    rsSurvey.Open strSQL, adoCon

    'Loop through the recordset
    Do While not rsSurvey.EOF

    ****SOME CODE TO COUNT THIS and USE IT for % of total OR HOW TO CALL jscript with the count like 'return Compile(count)'
    rsSurvey.MoveNext

    Loop

    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    You can use count() to count the number of row returned by the query.

    eg.

    SELECT count(*) FROM survey WHERE survey.techname = 'TECH-A'

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page