C#三层中的分页

   最近写了一个winform的管理系统,里面的分页同学推荐了几种,感觉都不好用,比较麻烦,自己就找了一个比较简单的分页,利用数据存储过程来分页。

reate proc usp_User
@pageIndex Int=1,//页码默认值
@paGeSize INt=2//页容量默认值
AS
begin
select * from(select ROW_NUMBER() over(order by uid)AS rownum,* from dbo.LoginUser where ustate=1) as t
where t.rownum between @paGeSize *(@pageIndex-1)+1 and @pageIndex*@pageSize
End

 

调用存储过程

Exec usp_User 1,2

我认为用于winform中管理系统都比较实用,简单。

posted @ 2015-07-10 10:17  小唐糖  阅读(188)  评论(0编辑  收藏  举报