SQL COUNT. , , .
<%
Set rsscroll = Server.CreateObject("ADODB.Recordset")
Dim strSQLscroll, rsscroll, intRow
strSQLscroll = "SELECT COUNT(*) AS Total FROM tblItems WHERE expiration_date > getdate();"
rsscroll.open strSQLscroll, oConn
response.write rsscroll("Total")
rsscroll.close: set rsscroll = nothing
oConn.close: set oConn = nothing
%>
, "Total". (, , .)
RecordSet , " " . , . ( RecordSet.RecordCount -1, .)
RecordSet.Open " " "Keyset" ( 1), RecordCount . ( " " " " , .)
RecordsetObject.Open "TableName|SQLStatement", ConnectionObject [,Cursor Type] [,Lock Type] [,Command Type]
RecordSet. , RecordCount.
<%
Set rsscroll = Server.CreateObject("ADODB.Recordset")
Dim strSQLscroll, rsscroll, intRow
strSQLscroll = "SELECT * FROM tblItems where expiration_date > getdate() order by expiration_date desc;"
rsscroll.open strSQLscroll, oConn, 1
intRow = rsscroll.RecordCount
' ... do something with intRow
rsscroll.close: set rsscroll = nothing
oConn.close: set oConn = nothing
%>
- , RecordSet.GetRows() .
<%
Dim rsscroll, intRow, rsArray
Set oConn = CreateObject("ADODB.Connection")
oConn.open "<connection string>"
strSQLscroll = "SELECT * FROM tblItems where expiration_date > getdate() order by expiration_date desc"
Set rsscroll = conn.execute(strSQLscroll)
if not rsscroll.eof then
rsArray = rsscroll.GetRows()
intRow = UBound(rsArray, 2) + 1
response.write "rows returned: " & intRow
' ... do any other operations here ...
end if
rsscroll.close: set rsscroll = nothing
oConn.close: set oConn = nothing
%>