create proc [dbo].[GetTestAFenYe]@pageSize int,@pageIndex intASSELECT * FROM ( SELECT ROW_NUMBER() OVER (ORDER BY id) AS aa,* FROM [User])as bbWHERE aa BETWEEN ((@pageSize*@pageIndex)+1) AND (@pageSize*(@pageIndex+1))这是分页的存储过程,pageIndex是第几页,pageSize是每页显示的条数,上一页就pageIndex--,下一页pageIndex++,总页数就在写一个方法查询总个数: pageSum = count % PageSize == 0 ? pageSum : (pageSum + 1);count是总个数,pageSum是总页数,给结果绑定就可以了