对于mssql,最好用存储过程分页,对于access, 我直接用SQL语句分页. 如: select top 每页记录数 [字段列表...] from 查询的表 where 主键 not in( select top (每页记录数*(当前页码) 主键 from 查询表 [where 查询条件] 排序方式 ) 排序方式
select top 每页记录数 b.* from (select top (当前页 + 1) * 每页记录数 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order by a.排序字段
我直接用SQL语句分页.
如:
select top 每页记录数 [字段列表...] from 查询的表 where 主键 not in( select top (每页记录数*(当前页码) 主键 from 查询表 [where 查询条件] 排序方式 ) 排序方式