{---ComboBox组件读取数据库过程,返回无重复值---}
{引用方法为:CustomComboBoxFun(ADOQuery组件名,ComboBox组件名,'表名')}
procedure CustomComboBoxFun(Query: TADOQuery; ObjectName: TComboBox; Value, TableName: string);
begin
with Query do begin
Close;
SQL.Text:=format('Select Distinct(%s) from %s', [Value, TableName]);
Open;
while not eof do begin
ObjectName.Items.Add(FieldValues[Value]);
Next;
end;
end;
end;