String sql = "SELECT TOP "+form.getPageSize()+" tb.* from( " + "select ROW_NUMBER() OVER ( order by id desc) AS RowNumber, id,name from t_role " + " ) ...
String sql = "SELECT TOP "+form.getPageSize()+" tb.* from( "
+ "select ROW_NUMBER() OVER ( order by id desc) AS RowNumber, id,name from t_role "
+ " ) tb WHERE RowNumber > "+((form.getPageindex() - 1) * form.getPageSize());
上面的這種分頁比select top 10 id from student where id not in (select top 5 id from student)
如果加條件的話下麵需要雙份,上面只需要一份條件。上面的分頁條件比較好。