[thelist] rs.PageCount

Mike King mike.king at redroom.co.uk
Thu Feb 1 17:53:48 CST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have no idea where I picked this up, but it's a loose template for paging 
recordsets.
It can be cleaned up A LOT!

Cheers
mk

<%
          Dim current_page ,rowcount ,i

          current_page = TRIM(request.QueryString("current_page"))
          If current_page = "" Then
             current_page = 1
          End If

          Dim objCon, objRS, strSQL
          Set objCon = Server.Createobject("ADODB.Connection")
          Set objRS = Server.CreateObject("ADODB.Recordset")
          strSQL = "SELECT * FROM Table"
          objCon.open
          objRS.open strSQL, objCon
          objRS.pagesize = "your value required"
          objRS.absolutepage = CINT(current_page)
          rowcount = 0
         %>

         <TABLE>

         <% While Not objRS.eof And rowcount < objRS.pagesize%>

         <TR><TD>
          <%=objRS(recordset number)%>
          <%=objRS(recordset number)%>
          <%=objRS(recordset number)%>
         </TD></TR>

         <%
            objRS.movenext
            rowcount = rowcount + 1
          Wend
         %>

         </TABLE>

         <% for  i =1 to objRS.pagecount %>

         <A href = "paging.asp?current_page=<%=i%>"><%=i%></A>

         <% Next %>

At 21:49 01/02/2001, Cory Preus wrote...

>Okay, this begs the question...what is a good solution for pagination with
>ADO then? I'd hesitate to dump the recordset in a session variable to
>mantain my cursor position...

- --
http://www.redroom.co.uk
t. 07971 292 999
e. mike.king at redroom.co.uk
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOnnixvoJZSzUdy33EQLKRwCdFVfRQYpkr+MAVylMS5KJ6h90vAoAn0Wt
Y0EYsMvDuf1lw/wLHf4f4P7+
=rDcZ
-----END PGP SIGNATURE-----





More information about the thelist mailing list