query.close;
query.sql.clear;
query.sql.add('你的sql语句');
query.sql.open;
cbox.clear;
while not query.eof do
begin
fname:=query.Fieldbyname('字段名').asstring;
cbox.items.add(fname);
query.next;
end;
procedure Tf_jinhuo.FormShow(Sender: TObject);
begin
flatcombobox2.Items.Clear;
ado_pub.Close;
ado_pub.SQL.Clear;
ado_pub.SQL.Add('select distinct(b_name) as b_name from t_bale');
ado_pub.Open;
while ado_pub.Eof<>true do
begin
flatcombobox2.Items.Add(ado_pub.fieldbyname('b_name').AsString);
ado_pub.Next;
end;
end;
procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
combobox1.items.clear;
table1.first;
while not table1.eof do
begin
combobox1.items.add(table1.fieldvalues['id'];
table1.next;
end;
end;
table1.first;
while not table1.eof do
begin
combobox1.items.add(table1.fieldbyname('字段名').asstring;
table1.next;
combobox1.text:=table1.fieldbyname('').asstring;
procedure TF_form1.FormShow(Sender: TObject);
var i:integer;
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select distinct 名称 from 名称');
adoquery1.Open;
combobox1.Items.Clear;
for i:=0 to adoquery1.RecordCount-1 do
begin
combobox1.Items.Add(trim(adoquery1.fieldbyname('名称').AsString));
adoquery1.Next;
end;
end;
combobox1.Clear;
adoquery1.SQL.Add('select ygxm from ygb');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
while adoquery1.Eof<>true do
begin
combobox1.Items.Add(adoquery1.Fieldbyname('ygxm').asstring);
adoquery1.Next;
end;
combobox1.ItemIndex:=0;
adoquery1.close;