无意义的代码。但是看到了还是给你修改下。
const
sql = 'select distinct %s from well_basic';
var
strlist : TStringList;
icount : integer;
begin
adoquery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from well_basic ');
ADOQuery1.Open;
strlist := TStringList.Create;
ADOQuery1.GetFieldNames(strlist);
for icount := 0 to strlist.Count - 1 do
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(Format(sql, [strlist.Strings[icount]]));
ADOQuery1.Open;
ADOQuery1.First;
while not adoquery1.Eof do
begin
ComboBox2.Items.Add(strlist.Strings[icount] + ':' + ADOQuery1.FieldByName(strlist.Strings[icount]).AsString);
adoquery1.Next;
end;
end;
strlist.Free;
end;
combobox2.Items.Add(QUERY1.FieldByName('distinct').asString);