How do I return multiple counts for display in an ASP 3.0 page?
For example, I want to display record counts for each state on the page.
Something that looks like this:
CA - 50
NY - 12
SC - 18
Right now I loop through each state (the id for each state), open a record
set, execute a query, print the count, close the recordset and repeat like
this:
Dim cnt
cnt=1
Do while cnt <= 50
ssql="SELECT count(*) FROM states WHERE stateid =" & cnt
With rs
.CursorLocation=3 'adUserClient
.ActiveConnection=cn
.source=sSql
.Open
End With
Response.Write (rs.Fields(0))
cnt=cnt+1
rs.Close
loop
Obviously this not very efficient. Can anyone suggest an improvement?
Remember I am working with Access so I believe I have to return a record set
rather than accessing a singleton like a SQL Server RETURN value.
Any ideas would be appreciated.
Dave