日期:2014-05-17  浏览次数:20473 次

sql转access分页语句。
SQL code
SELECT TOP (@pagesize) id,(select count(commentid) from Comment where commentparentid=id and commenttype=2  ) as sum2,name,author,date,content,Cover_pic,Views_number  FROM dbo.down WHERE id <= ( SELECT ISNULL(MIN(id),0) FROM ( SELECT TOP (@pagesize*(@page-1)+1) id FROM down ORDER BY id Desc ) A ) ORDER BY id Desc


转access 怎么弄??? 没用过access

------解决方案--------------------
如果数据源数据量小,可以用双top方法;否则用max方法。
sqlStr = String.Format("select top {0} * from 测试 where 学号>(select max(学号) from (select top {1} 学号 from 测试))", pageSize, ((pageIndex - 1) * pageSize));