#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    14
    Rep Power
    0

    Question Utilising Paging of results


    Hi,

    I want to give my users the ability to page through the results rather than delivering all results to one web page. I was thinking what is the best way to do this. So far I have thought of

    1. Use a scrollable resultset and store rs in session.
    2. Hit the database to get the IDs and store these in the session and then hit the dbase each time the next or prev button is pressed (Thought this way might be slow)

    Any ideas welcomed.


    Thanks


    Justin
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    I would suggest against putting a restultset in a session. A resultset keeps a connection open to the database and a session usually lasts 30 minutes. That is prohibitively long to keep one connection open to the database. You would see performance problems as soon as you deployd your app.

    I would either read the whole resultset into some type of collection (that you can then put in the session) and read through it at your leisure later, or if you have a database that can handle it (like MySql) you can provide starting indexes and number of records to retrieve in the query. See the LIMIT keyword in the SELECT syntax
    http://www.mysql.com/documentation/m...ce.html#SELECT

IMN logo majestic logo threadwatch logo seochat tools logo