表加一个 ID ,Int ,标识自增var i : Integer ; //全局FormCreate : i := 0 ;procedure TForm1.Button1Click(Sender: TObject); //打开 ,每次显示 10 条记录 begin with ADOQuery1 do begin Close ; Sql.Text := 'select * from zhang_cpkkc where Id > ' + IntToStr(10*i) + ' and id < ' + IntToStr(10*i + 11) ; Open ; First ; end; i := i + 1 ; if TButton(Sender) = Button1 then Button1.Enabled := False ;end;procedure TForm1.Button2Click(Sender: TObject);//下一页 begin Button1Click(Button1) ; end;
Sql.Text := 'select * from zhang_cpkkc where Id > ' + IntToStr(10*i) + ' and id < ' + IntToStr(10*i + 11) ;
begin
with ADOQuery1 do
begin
Close ;
Sql.Text := 'select * from zhang_cpkkc where Id > ' + IntToStr(10*i)
+ ' and id < ' + IntToStr(10*i + 11) ;
Open ;
First ;
end;
i := i + 1 ; if TButton(Sender) = Button1 then Button1.Enabled := False ;end;procedure TForm1.Button2Click(Sender: TObject);//下一页
begin
Button1Click(Button1) ;
end;
+ ' and id < ' + IntToStr(10*i + 11) ;
select top 每页显示数目 字段名 from 表名 where 字段名 not in(select top 每页显示数目*页数 from 表名 group by 字段名) group by 字段名
select top 500 from ……不是很清楚,学习
上面這個方法還不錯。