数据有1000条,按钮是“下一页”或“上一页”功能让它上或下每页显示10条. 
with AdoQuery1 do 
begin 
close; 
sql.Clear; 
sql.Add('SELECT * from A order by id desc'); 
Open; 
Recordset.PageSize:=10; 
Recordset.AbsolutePage:=2; 
while not AdoQuery1.eof do 
begin 
StringGrid1.Cells[0,i]:=Fields[0].Value; 
StringGrid1.Cells[1,i]:=Fields[1].Value; 
Next; 
end; 怎么不显示呢。请高手代我修改写全点。谢谢

解决方案 »

  1.   

    with AdoQuery1 do 
    begin 
      close; 
      sql.Clear; 
      sql.Add('SELECT * from A order by id desc'); 
      Open; 
      Recordset.PageSize:=10; 
      Recordset.AbsolutePage:=2;   while not AdoQuery1.eof do 
      begin 
        StringGrid1.RowCount := StringGrid1.RowCount + 1; // 新增一行
        StringGrid1.Rows[StringGrid1.RowCount-1][0]:=Fields[0].AsString; // 修改最后一行的第1列和第2列
        StringGrid1.Rows[StringGrid1.RowCount-1][1]:=Fields[1].AsString; 
        Next; 
      end; end;
      

  2.   


    上面没有用的。不过我自己解决了。
    参考:http://www.techrss.cn/html/2007/05-13/8480.htm