无为清净楼资源网 Design By www.qnjia.com
所以最好在数据访层分页,如果这样就要使用存储过程来分页.以下是以pubs 数据库中的employee表为例来进行数据分页的存储过程,你可以参考它根据实际情况来创建自己的存储过程.

注:@pageindex 数据页的索引,@dataperpage 每页的记录数目,@howmanyrecords 用来获取总的记录数.
复制代码 代码如下:
create proc getdata @pageindex int,@dataperpage int,@howmanyrecords int output
as
declare @temptable table
(
rowindex int,
emp_id char(9),
fname varchar(20),
minit char(1),
lname varchar(30)
)
insert into @temptable
select row_number() over(order by emp_id) as rowindex,emp_id,fname,minit,lname
from employee
select @howmanyrecords=count(rowindex) from @temptable
select * from @temptable
where rowindex>(@pageindex-1)*@dataperpage
and rowindex<=@pageindex*@dataperpage

declare @howmanyrecords int
exec getdata 2,5,@howmanyrecords output
select @howmanyrecords
declare @x int, @y int, @z int
select @x = 1, @y = 2, @z=3
select @x,@y,@z

create proc getdata2 @pageindex int,@dataperpage int,@howmanyrecords int output
as
declare @temptable table
(
rowindex int,
emp_id char(9),
fname varchar(20),
minit char(1),
lname varchar(30)
)
insert into @temptable
select row_number() over(order by emp_id) as rowindex,emp_id,fname,minit,lname
from employee
select @howmanyrecords=count(rowindex) from @temptable
select * from @temptable
where rowindex>(@pageindex-1)*@dataperpage
and rowindex<=@pageindex*@dataperpage

其中Row_number 函数可以给检索来的每条记录按照排序来编号.

接下来你就可以在asp.net 网页后台代码中调用该存储过程,就可以获取想要的数据.
标签:
数据访问层,存储过程,分页

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。