How can i display some records from table in a page
Vimal Gandhi
Greenhorn
Joined: Nov 29, 2000
Posts: 9
posted
0
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
Joined: Jan 07, 1999
Posts: 6913
posted
0
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.