哦,来晚了,给你一份看的很清楚的。procedure ThwglForm.ComboBox1DropDown(Sender: TObject);
begin
combobox1.Items.Clear ;
if not (utdatamoule.DataModule2.hwglcADODataSet.Active) then
utdatamoule.DataModule2.hwglcADODataSet.Active :=true;
try
utdatamoule.DataModule2.hwglpzADODataSet.Close;
utdatamoule.DataModule2.hwglpzADODataSet.CommandText:='select distinct pzbh from cjpz' ;
utdatamoule.DataModule2.hwglpzADODataSet.Open;
while not (utdatamoule.DataModule2.hwglpzADODataSet.Eof) do
begin
combobox1.Items.Add(utdatamoule.DataModule2.hwglpzADODataSet.fieldbyname('pzbh').AsString );
utdatamoule.DataModule2.hwglpzADODataSet.Next ;
end;
finally
utdatamoule.DataModule2.hwglpzADODataSet.Close;
utdatamoule.DataModule2.hwglpzADODataSet.CommandText:='select pzbh, pz,cjbh from CJPZ';
utdatamoule.DataModule2.hwglpzADODataSet.Open;
end;
end;