Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i display some records from table in a page

 
Vimal Gandhi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic