PDA

View Full Version : Record Count


admin
05-28-2003, 10:54 PM
Several ways to get a recordset count...

<%
set MyConn=Server.CreateObject("adodb.connection")
MyConn.Open "DSN=myDSN"
set RS=MyConn.Execute("Select Count(*) from mytable")
myrecordcount=RS(0)
RS.close
set RS=nothing
MyConn.close
Set MyConn=nothing
%>

Or

<%
Set objConn=Server.CreateObject("adodb.recordset")
objConn.Open SQLString, Connection, 1, 3
objConn.RecordCount
%>

Or you can replace RecordCount with BookMark:

<%
Set objConn=Server.CreateObject("adodb.recordset")
objConn.Open SQLString, Connection, 1, 3
objConn.BookMark
%>

Thanks James H.