A Friend in Need is a Friend in Deed.
Become a Member at ITTreats.com !! Share Your invaluable Experience to Fellow Programmers. Signup, Start Blogging and support fellow Techies.

Paginating in ASP

Pagination in asp, plays major roll when you want to display page wise results , what if the recordset size is more or huge, in that case the processing of the page will become slow…

For that here is the query , which will really help you

the following query is MSSQL query

For example if you want employee name whose
salaries are 2nd highest and 1oth highest

Now,

step 1 :select *, ROW_NUMBER() over ( salary desc) as ROWID from emp

step 2 : supply the above query as sub query

select * from ( select *,ROW_NUMBER() over (salary desc) as ROWID from emp ) where rowid between 2 and 10

thats it .. now you will get emploee list from 2nd highest salary to 10th highest salary ,,,,

by making use of the above query in pagination purpose, then your page will never slow down becoz, we are putting only 10 to 100 rows at max ,

Article Written by : adrevol
( Articles Submitted : 47 Articles Commented : )




Leave a Reply