Paging design recommendation for asp.net and sqlserver 2005

為{幸葍}努か 提交于 2019-12-07 16:24:57

问题


I am relatively new to programming. My work basically revolves around data and analysis. I want to create a simple asp.net page which shows huge chunk of data from the database. There could be a millions of rows of data which is used for different kinds of analysis/searchin/filtering etc..

Should I write paging logic at the front end or at the back-end (in this case SQL Server 2005)?

What would be the best practice around this? Your suggestions/links to resources in this direction is greatly appreciated.


回答1:


please use this example Building Custom Paging with LINQ, ListView, DataPager and ObjectDataSource

Paging of Large Resultsets in ASP.NET ListView and DataPager

Custom paging in ASP.NET with ListView & DataPager

Implementing Custom Paging in ASP.NET with SQL Server 2005




回答2:


You may be interested in this... Paging of Large resultset in asp.net




回答3:


I would suggest you create a stored procedure to query and page your data. Linq To SQL is a fast an easy way to execute the stp.

Simple example of stored procedure to take care of paging:

CREATE PROCEDURE [dbo].[stp_PagingSample]
(
    @page int,
    @pagesize int
)
AS

WITH Numbered AS
(
    SELECT *, ROW_NUMBER() OVER (ORDER BY ID) AS 'RowNumber'
    FROM tbl_YourTable
) 
SELECT * 
FROM Numbered
WHERE RowNumber BETWEEN ((@page - 1) * @pagesize) + 1 AND (@page * @pagesize);

The stored procedure is the tricky part. But drop a comment if you would like me to add more sample code executing the stp and rendering the data... :)



来源:https://stackoverflow.com/questions/1418105/paging-design-recommendation-for-asp-net-and-sqlserver-2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!