if giPage = 1 then begin sSQL := ‘SELECT TOP 10 * FROM dw_demo WHERE ‘+sWhere +‘ ORDER BY ‘+sOrder+‘ DESC‘; end else begin sSQL := ‘SELECT TOP 10 * FROM dw_demo WHERE id NOT IN (‘ +‘SELECT TOP ‘+(giPage*10-10).ToString+‘ id FROM dw_demo ‘ +‘WHERE ‘+sWhere+‘ ORDER BY ‘+SOrder +‘ DESC‘ +‘) AND ‘+sWhere +‘ ORDER BY ‘+sOrder +‘ DESC‘; sSQL := ‘select top 10 * from dw_demo where id not in (select top ‘+(giPage*10-10).ToString+‘ id ‘ +‘from dw_demo order by ‘+sOrder+‘ desc) order by ‘+sOrder+‘ desc ‘; end;
保存一下Access的分页代码。 实在有点折磨人!
//得到排序 case giSort of 0 : begin //view sOrder := ‘[view],id‘; end; 1 : begin //时间 sOrder := ‘createtime,id‘; end; 2 : begin //star sOrder := ‘star,id‘; end; 3 : begin //download sOrder := ‘download,id‘; end; 4 : begin //buy sOrder := ‘buy,id‘; end; end;