This article mainly introduces the method of obtaining the return value of the Select Count statement in ASP. It is generally used to use the Select Count statement when statistical data is used to obtain the number of queried rows. Friends who need it can refer to it.
We generally use the Select Count(*) statement when counting database records. When we use the query analyzer of SQL Server, directly entering Select Count(*) From the table name will count how many records there are in the table. However, How should we return the value when we use ASP to implement it? That is, how to output the total number of recorded records? Please read on.
In fact, we only need to give the query results of the SQL statement an alias to solve the problem, and then use the ASP statement to output the alias. The relevant code is as follows:
Copy the code code as follows:
Set rs=conn.Execute("Select Count(*) As 'Total' From table")
Response.Write rs("Total")