How to check the number of records in the RecordSet?
We can use the RecordCount to check How many records in the Recordset; but if the cursor type is ForwardOnly, the RecordCount will return -1.
The ASP codes are written and described as below:
<%
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set rs = Server.CreateObject("Adodb.Recordset")
rs.open "Member",conn,1,3
If Not rs.EOF Then
Response.write("Now, you have " & rs.RecordCount & " records.")
End If
rs.Close
Set rs = nothing
%>
No comments:
Post a Comment