分页有很多种方法,给分享最省资源的SQL语句方法,一句话的 仅供参考
[C#] 纯文本查看 复制代码 create proc usp_GetPostsAll
@PageIndex int,
@PageSize int
as
begin
select * from (select ROW_NUMBER() over(order by postId) as nid,* from Posts ) as nposts where nid between (@PageIndex - 1) * @PageSize + 1 and @PageSize * @PageIndex and
IsPublished='true'
end
go
把表面列名一换就行,其他的就在DAL层操作吧
|