• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

How can i display some records from table in a page

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello advisers
I want to display records from a particular table in SQL server. If I have thousands of record then i want to display 20 records per page.
What is feasible solution among following.
1) I fire one qurey which fetch all data from it and then i store it in a ArrayList or Vector object & then display.
2) I fire query and fetch only 20 record by "select top 20 from table where rec_id > 0" for first time , next time condition will be rec_id > 20", That way i can get limited 20 rows from table (This is only possible in case of rec_id is a field in table) Now anyone tell me which is feasible.
Thanks in advance
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either is feasible. And there are other options, too.
3) Retrieve several pages-worth at once, so that the next few requests will be quicker, but you won't fill up your computer's memory. This is particularly effective on search-engine type applications, where very few people bother with more than the first few pages.
4) Think a bit more about why you need to retrieve "thousands" of records. Is anyone really going to page through all of them 20 at a time, or should you offer smarter selection so they can find just the ones they want to see.
 
reply
    Bookmark Topic Watch Topic
  • New Topic