先取得总记录条数 ,这里用 AllRecCountNeedSelCount := (AllRecCount div 20)if NeedSelCount = 0 then //那么就是 总记录小于20咯。 begin //直接select 显示 end else begin For 循环变量 := 0 to NeedSelCount select Top 20 * from ( select * from 表名 where 条件 ) as 查询结果假名 where 主键<(select min(主键) from (select top '+inttostr(循环变量*20)+' 主键 from ( select * from 表名 where 条件 ) as 查询结果假名 order by 主键 desc ) as 查询结果假名2 ) order by 主键 desc end;你看看
能详细说说吗,最好能有个例子,CacheSize的用法到底是怎样实现的?他是限制取2000条数据,还是限制DBgrid每次取20条记录啊
http://tech.sina.com.cn/c/2001-07-31/4790.html---------------------------------------------------http://kmok.cn
begin
//直接select 显示
end
else
begin
For 循环变量 := 0 to NeedSelCount
select Top 20 * from
(
select * from 表名
where 条件
) as 查询结果假名
where 主键<(select min(主键) from (select top '+inttostr(循环变量*20)+' 主键 from
(
select * from 表名
where 条件
) as 查询结果假名
order by 主键 desc
) as 查询结果假名2
) order by 主键 desc
end;你看看
结贴