how to count records in ASP classic?

前端 未结 9 986
陌清茗
陌清茗 2021-01-14 02:50

I\'m not quite familiar with programming ASP classic. I just need a small code to run on my webpage. How do i count the record of the returned query?

<%
S         


        
9条回答
  •  有刺的猬
    2021-01-14 03:06

    I usually use a separate query like "select count(*) from table " to get counts because I usually need not only the count but a summation of the number of units or the average price or whatever and it's easier to write a separate query than to make more variables and say "TotalUnits = TotalUnits + rs("Units").value" inside the loop to display the results. It also comes in handy for the times you need to show the totals above the results and you don't want to loop though the recordset twice.

提交回复
热议问题