ASP.NET,SQL 2005"寻呼" [英] ASP.NET, SQL 2005 "paging"

查看:86
本文介绍了ASP.NET,SQL 2005"寻呼"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是有关这一问题的后续:
<一href=\"http://stackoverflow.com/questions/1014526/asp-net-next-$p$pvious-buttons-to-display-single-row-in-a-form\">http://stackoverflow.com/questions/1014526/asp-net-next-$p$pvious-buttons-to-display-single-row-in-a-form

This is a followup on the question: http://stackoverflow.com/questions/1014526/asp-net-next-previous-buttons-to-display-single-row-in-a-form

因为它说上面的页面上,那里有页面上的previous /下一个按钮,即在同一时间检索单行的。

As it says on the page above, theres a previous/next button on the page, that retrieves a single row one at a time.

完全有〜50万行数据。

Totally there's ~500,000 rows.

在我的页面通过每个订阅新资料数量,形式得到填补与用户的详细信息。我应该使用什么方法在SQL服务器上?

When I "page" through each subscribtion number, the form gets filled with subscriber details. What approach should I use on the SQL server?

使用ROW_NUMBER()函数似乎有点矫枉过正,因为它有号码的所有〜500.000行(我猜?),所以还有什么其他可能的解决方案有哪些?

Using the ROW_NUMBER() function seems a bit overkill as it has to number all ~500.000 rows (I guess?), so what other possible solutions are there?

在此先感谢!

推荐答案

ROW_NUMBER()可能是你最好的选择。

ROW_NUMBER() is probably your best choice.

从这个MSDN文章: http://msdn.microsoft.com/en -us /库/ ms186734.aspx

From this MSDN article: http://msdn.microsoft.com/en-us/library/ms186734.aspx

WITH OrderedOrders AS
(
    SELECT SalesOrderID, OrderDate,
    ROW_NUMBER() OVER (ORDER BY OrderDate) AS 'RowNumber'
    FROM Sales.SalesOrderHeader 
) 
SELECT * 
FROM OrderedOrders 
WHERE RowNumber BETWEEN 50 AND 60;

和刚subsititute 50和60有你想要的行号的参数。

And just subsititute 50 and 60 with a parameter for the row number you want.

这篇关于ASP.NET,SQL 2005&QUOT;寻呼&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆