procedure RefreshQuery(AQuery: TQuery; const FieldsForSearch: string);
var
AList: TList;
AVarArray: Variant;
i: Byte;
begin
AList := TList.Create;
try
AQuery.GetFieldList(AList, FieldsForSearch);
AVarArray := VarArrayCreate([0, AList.Count - 1], varVariant);
for i := 0 to Pred(AList.Count) do
AVarArray[i] := TField(AList.Items[i]).AsVariant;
AQuery.Close;
AQuery.Open;
AQuery.Locate(FieldsForSearch, AVarArray, []);
finally
AList.Free;
AVarArray.Free;
end;
end;
|