Paging

  • Thread starter Thread starter hoz
  • Start date Start date
H

hoz

Hi ,
I use a procedure to get list of all users and show them in a
datagrid/datalist/etc.. with SqlDataReader . How can i list X item (lets
say 50) on the first page , 2. 50 on second page and so on
 
The DataReader only returns the rows you ask for. If you ask for all of the
users at once, you need to fetch all of them. If you only want 50 then build
the SELECT to ask for 50 (using TOP is one way to limit rows if your server
supports it). When you're ready for the next 50, execute a SELECT that
starts returning rows based on a value higher than the last row fetched the
first time.


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top