[thelist] rs.PageCount

Scott Dexter sgd at ti3.com
Thu Feb 1 17:31:48 CST 2001

> > (re-think how you page through the recordset in the first 
> 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...

OUCH! Putting the recordset into a Session variable would be much, much
worse. Depending on the backend, you can do a couple things:

SQL Server 7: maintain a record index variable, and do a Select TOP x with
the record index part of your where clause. Then as you go from page to page
you only pull out what you need, based on the index variable.

I think Oracle has a TOP clause in the Select statement, Rudy?

You can also be meticulous about tracking the start and ending records, and
shift your where clause from page to page. This makes it a little bit of a
stretch to get the total number of pages (you can do it up front and call it
overhead), but also cuts down the load.

And what we've also done here (Ti3) is load up the whole recordset into a
Dictionary object (not the built in one, but the one from Caprock:
http://www.caprockconsulting.com/ --it is free-threaded, whereas the
built-in one is not, and therefore safe to put into a Session variable) and
use ASP scripting only to page through it. This way the database is hit only
once. --Its almost the same as loading the recordset into a Session
variable, but cleaner and nicer to the web server. (Recordset objects bring
IIS to its knees if they are in Session variables, as do Connection objects)

I also just read an article on http://4guysfromrolla.com/ that has shifted
my views on using the client-side cursor. Check it out, it makes reasonable
sense to implement, looks pretty lean, and uses PageCount and RecordCount:


More information about the thelist mailing list