Hi friends... I want to run sql select query command to retrive the 10 records on each page based on the page number. for example if pagenumber = 2 then I want to retrive records only from 20 to 30. Right now what I am doing is that I am selecting the all records and for displaying records from 20 to 30, first I am looping to make cursor to read up to 20th position then from that I am displaying the records.
Code: select * from table
while loop sqlreader.read() end while
Problem is that for large records it will take lots of time to run this query.. Please suggusts me some better way to do this....
See the following for a kludgy workaround (works with the Pubs database): select * from ( select top 10 emp_id,lname,fname from ( select top 30 emp_id,lname,fname from employee order by lname asc ) as newtbl order by lname desc ) as newtbl2 order by lname asc