class procedure DBTools.FillStrings(ComboBoxEh: TDBComboBoxEh; sql: string; Default: Boolean = False);
var
Q2: TADOQuery;
begin
ComboBoxEh.KeyItems.Clear;
ComboBoxEh.Items.Clear;
Q2 := ExecuteSelect(sql);
if Q2.FieldCount = 1 then
begin
if Default then
ComboBoxEh.Items.Append('全部');
while not Q2.Eof do
begin
ComboBoxEh.Items.Append(Q2.Fields[0].AsString);
Q2.Next;
end;
end;
if Q2.FieldCount >= 2 then
begin
if Default then
begin
ComboBoxEh.KeyItems.Append(' ');
ComboBoxEh.Items.Append('全部');
end;
while not Q2.Eof do
begin
ComboBoxEh.KeyItems.Append(Q2.Fields[0].AsString);
ComboBoxEh.Items.Append(Q2.Fields[1].AsString);
Q2.Next;
end;
end;
Q2.Close;
Q2.Free;
if ComboBoxEh.DataSource = nil then
ComboBoxEh.ItemIndex := 0;
end;

class procedure DBTools.FillStrings(ColumnEh: TColumnEh; sql: string; Default: Boolean = False);
var
Q2: TADOQuery;
begin
ColumnEh.KeyList.Clear;
ColumnEh.PickList.Clear;
Q2 := ExecuteSelect(sql);
if Q2.FieldCount = 1 then
begin
if Default then
ColumnEh.PickList.Append('全部');
while not Q2.Eof do
begin
ColumnEh.PickList.Append(Q2.Fields[0].AsString);
Q2.Next;
end;
end;
if Q2.FieldCount >= 2 then
begin
if Default then
begin
ColumnEh.KeyList.Append(' ');
ColumnEh.PickList.Append('全部');
end;
while not Q2.Eof do
begin
ColumnEh.KeyList.Append(Q2.Fields[0].AsString);
ColumnEh.PickList.Append(Q2.Fields[1].AsString);
Q2.Next;
end;
end;
Q2.Close;
Q2.Free;
end;