[thelist] limiting search results by number (SQL Server 7)

darren darren at web-bitch.co.uk
Mon Dec 10 05:34:50 CST 2001


On 09 December 2001 at 08:15:25, the list <webguy at mail.rit.edu> wrote:

CB> What I want to do is display a certain number of results per page based
CB> on the number of rows I retreive from a table.  I say 'search' because
CB> I'm using SQL Server's full-text search capability and it is, in
CB> effect, propelling a small search engine for my company's internal use.

if you're using asp, you might want to have a look at

   http://www.adopenstatic.com/experiments/recordsetpaging.asp

and i'm pretty usre there's plenty of stuff on learnasp.com and
4guysfromrolla.com on recordset paging.  one of the methods at adopenstatic
is to use a stored proc to only return the results that you want...which is
great if you have, for example, a searchable archive of a mailing list and
you want to return 20 messages along with their associated threads, which
means there could be any number of records actually being returned.

CB> If I choose the full-recordset method I will be returning hundreds
CB> upon thousands of rows everytime but only showing 21-40 or 101-120 (and so
CB> on).  I'd really rather not do that.

iirc, when you do recordset paging in asp+ado you don't get all the results
everytime, only the chunk that you need.  this is set up by the size that
you set your recordset cache for before you run the query and the database
*should* only be hit again when you want data that isn't in you cache.

that said, if the cache is bigger than the number of records being shon on
the page in one go, you need some way of persisting the data between pages.

anyway, the last time i had to do this was a good while ago and it always
seemed to return all the records on the first hit...but ymmv! :>

hth,

darren.





More information about the thelist mailing list