In ASP, if you use Set ors=oConn.Execute() to create a RecordSet object, and then use RecordSet.RecordCount to get the number of records, you will find that its value is -1. At this time, we can use the GetRows method to obtain Number of records. Copy the code code as follows:
<%
Dim oConn, ors, aRows
Dim i,j
Set oConn=Server.CreateObject(ADODB.Connection)
oConn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & Server.MapPath(database/newasp.resx)
Set ors=oConn.Execute(Select TOP 5 SoftID,SoftName FROM NC_SoftList)
Response.Write RecordCount: & ors.RecordCount & <br/> '-1
aRows=oRs.GetRows(-1) 'oRs.Eof=True,aRows(col,row)
Set ors=Nothing
oConn.Close()
Set oConn=Nothing
If IsArray(aRows) Then
Response.Write RecordCount: & UBound(aRows,2)+1 & <br/>
For i=0 To UBound(aRows,2)
For j=0 To UBound(aRows,1)
Response.Write aRows(j,i)
If j<> UBound(aRows,1) Then Response.Write ,
Next
Response.Write <br/>
Next
End If
%>