All of us would have implemented Paging in our applications.
Paging is particularly useful if you have lots of records to be displayed on a page and you can't get them displayed in one stretch. Say we have 1000 records to be displayed in a page. In this scenario, we cannot show up all the records in a single stretch
in the page. Hence we need to implement Paging functionality whereby users can see a set of records and then click on a Button/Link to view the next set of records.
This <a href="http://aspnet_harish.blogspot.com/2005_03_01_aspnet_harish_archive.html">Article</a> is useful to retrieve records in sets for displaying and useful in implementing custom paging.
Thank you guys for your solution , But in sql 2005 we have ROW_NUMBER() Function that help you write storedprocedure much easier :
Look at this sp:
CREATE PROCEDURE sprocEmailAddressSelectList
@contactPersonId int,
@startRowIndex int,
@pageSize int
AS
SELECT
Id,
Email,
EmailType,
ContactPersonId,
ConcurrencyId
FROM
(SELECT ROW_NUMBER() OVER (ORDER BY Id) AS Row,
Id,
Email,
EmailType,
ContactPersonId,
ConcurrencyId
FROM EmailAddress) AS EmailRows
WHERE
(Row between (@startRowIndex) AND @startRowIndex + @pageSize - 1)
AND ContactPersonId = @contactPersonId
for more information you can look at this article :
ranganh
Star
12085 Points
2435 Posts
Microsoft
Using SQL Server Stored Procedure for implementing Custom Paging
Mar 30, 2005 09:19 AM|LINK
Hi,
All of us would have implemented Paging in our applications.
Paging is particularly useful if you have lots of records to be displayed on a page and you can't get them displayed in one stretch. Say we have 1000 records to be displayed in a page. In this scenario, we cannot show up all the records in a single stretch in the page. Hence we need to implement Paging functionality whereby users can see a set of records and then click on a Button/Link to view the next set of records.
This <a href="http://aspnet_harish.blogspot.com/2005_03_01_aspnet_harish_archive.html">Article</a> is useful to retrieve records in sets for displaying and useful in implementing custom paging.
Thanks.
Harish
http://geekswithblogs.net/ranganh
weibailin
Member
10 Points
2 Posts
Re: Using SQL Server Stored Procedure for implementing Custom Paging
Mar 31, 2005 07:42 AM|LINK
hi,
http://aspnet_harish.blogspot.com/2005_03_01_aspnet_harish_archive.html
maybe it's not a correct link,I can't open it.[:'(]
thanks
Ramesh Bandi
Member
20 Points
10 Posts
Re: Using SQL Server Stored Procedure for implementing Custom Paging
Oct 29, 2009 07:05 AM|LINK
hello
the link is not working.
Ramesh Bandi
stanly
Star
13201 Points
2490 Posts
Re: Using SQL Server Stored Procedure for implementing Custom Paging
Oct 29, 2009 07:26 AM|LINK
http://www.dotnetfunda.com/articles/article456-custom-seo-friendly-paging-with-aspnet-repeater-or-datalist-control.aspx
same logic...
weblogs.asp.net/stanly
catherine se...
Member
704 Points
186 Posts
Re: Using SQL Server Stored Procedure for implementing Custom Paging
Oct 30, 2009 06:55 AM|LINK
Hi,
You can take a look at the following page for information on how to page in ASP.NET:
http://aspnet.4guysfromrolla.com/articles/091003-1.aspx
Love Version Control and .NET Scanner SDK
LastPhoenix
Member
15 Points
16 Posts
Re: Using SQL Server Stored Procedure for implementing Custom Paging
Nov 10, 2009 06:06 AM|LINK
Thank you guys for your solution , But in sql 2005 we have ROW_NUMBER() Function that help you write storedprocedure much easier :
Look at this sp:
CREATE PROCEDURE sprocEmailAddressSelectList @contactPersonId int, @startRowIndex int, @pageSize int AS SELECT Id, Email, EmailType, ContactPersonId, ConcurrencyId FROM (SELECT ROW_NUMBER() OVER (ORDER BY Id) AS Row, Id, Email, EmailType, ContactPersonId, ConcurrencyId FROM EmailAddress) AS EmailRows WHERE (Row between (@startRowIndex) AND @startRowIndex + @pageSize - 1) AND ContactPersonId = @contactPersonIdfor more information you can look at this article :
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=479