1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
procedure RemplirLookup(AConnection:TADOConnection; ALookupCombo: TDBLookupComboBox; const DataSQL, ListSQL, DataField, KeyField, ListField: string; T);
begin
ALookupCombo.DataSource := TDataSource.Create(ALookupCombo);
ALookupCombo.DataSource.DataSet := TADOQuery.Create(ALookupCombo);
with TADOQuery(ALookupCombo.DataSource.DataSet) do
begin
Connection := AConnection;
SQL.Text := DataSQL;
Open();
end;
ALookupCombo.DataField := DataField;
ALookupCombo.ListSource := TDataSource.Create(ALookupCombo);
ALookupCombo.ListSource.DataSet := TADOQuery.Create(ALookupCombo);
with TADOQuery(ALookupCombo.ListSource .DataSet) do
begin
Connection := AConnection;
SQL.Text := ListSQL;
Open();
end;
ALookupCombo.KeyField := KeyField;
ALookupCombo.ListField := ListField;
end; |
Partager