1、查询循环遍历数据
with adoquery1 do
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from 表名where 查询条件');
adoquery1.Open;
end;
遍历:
with adoquery1 do
begin
close;
sql.add('select * from 表名');
prepared;
open;
first;
while not eof do
begin
combobox1.items.add(fieldbyname('字段').asstring);
next;
end;
或者写成:
var
icount:integer;
icount:=adoquery1.recordcount;
for i:=1 to icount do
begin
combobox1.items.add(fieldbyname('字段').asstring);
next;
end;
或者是:
with adoquery1 do