jon24422531
Technical User
Using ASP I make a SQL query to a database table and then return the recordset to a formatted table.
This works fine but I would also like to count the number of records returned. Searching the Web gave me this:
However, when I use this then it appears that the recordet cannot be used again as the table is empty although the count is > 1
So is there any way I can use it more than once, or will I have to make two queries to SQL, one for data and one for the count of that data?
Many thanks.
Jonathan
Code:
set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "Driver={SQL Server};Server=FTLive;Database=WorkLog;Uid=app;Pwd=;"
Set rsData = Server.CreateObject("ADODB.Recordset")
strSQL = "select FaultNo, Fault, Resolution, UserID, FaultType, .......... etc
Code:
<%
Dim strCount
strCount = 0
While NOT RSData.EOF AND NOT RSData.BOF
strCount = strCount + 1
RSData.MoveNext()
Wend
%>
So is there any way I can use it more than once, or will I have to make two queries to SQL, one for data and one for the count of that data?
Many thanks.
Jonathan