procedure ComboBoxSalesNameDropDown(Sender : TObject);
var aSQLQuery : TSQLQuery;
begin
if TDBComboboxEH(Sender).Itemindex>0 then exit;
aSQLQuery:=TSQLQuery.Create(nil);
with aSQLQuery do try
Close;SQL.Clear;
SQLConnection:=SQLConn;
SQL.Add('Select emplId,empl from empl');
SQL.Add('where SysID=:SysID and emplStatus=''A''');
SQL.Add('and JopPosttype=''业务员'' order by Empl');
ParamByName('SysID').AsInteger:=GetSysID;
Open;
First;
TDBComboboxEH(Sender).KeyItems.BeginUpdate;
TDBComboboxEH(Sender).Items.BeginUpdate;
TDBComboboxEH(Sender).KeyItems.Clear;
TDBComboboxEH(Sender).Items.Clear;
TDBComboboxEH(Sender).KeyItems.Add('所有');
TDBComboboxEH(Sender).Items.Add('所有');
while not Eof do begin
TDBComboboxEH(Sender).KeyItems.Add(FieldByName('empl').AsString);
TDBComboboxEH(Sender).Items.Add(FieldByName('Empl').AsString);
Next;
end;
finally
Free;
TDBComboboxEH(Sender).KeyItems.EndUpdate;
TDBComboboxEH(Sender).Items.EndUpdate;
end;
end