while not query.eof do begin combox.item.add(Query.fieldByName('field').asstring); Query.next; end
向一个combobox中添加itemcombobox1.Items.clear; with qry do begin close; sql.Clear; sql.add('select * from table1 order by zd1'); open; first; end; if qry.RecordCount>0 then combobox1.text:=qry.fields[2].asstring; repeat combobox1.Items.Add(qry.fields[2].asstring); until qry.findnext=false;
combobox1.Items.clear; with ADOQuery1 do begin Close; Clear; SQL.Add('select * from Table'); Open; end; if AdoQuery1.RecordCount > 0 then begin ADOQuery1.First; while not ADOQuery1.Eof do begin ComboBox1.Items.ADD(ADOQuery1.FieldByName(FieldName).AsString); ADOQuery1.Next; end; end;
begin
combox.item.add(Query.fieldByName('field').asstring);
Query.next;
end
with qry do
begin
close;
sql.Clear;
sql.add('select * from table1 order by zd1');
open;
first;
end;
if qry.RecordCount>0 then
combobox1.text:=qry.fields[2].asstring;
repeat
combobox1.Items.Add(qry.fields[2].asstring);
until qry.findnext=false;
with ADOQuery1 do
begin
Close;
Clear;
SQL.Add('select * from Table');
Open;
end;
if AdoQuery1.RecordCount > 0 then
begin
ADOQuery1.First;
while not ADOQuery1.Eof do
begin
ComboBox1.Items.ADD(ADOQuery1.FieldByName(FieldName).AsString);
ADOQuery1.Next;
end;
end;