procedure sqlQuery(query: tadoquery; Asql: string; params: array of const);
begin
with query do
begin
close;
sql.Clear;
sql.Text := format(Asql, params);
open;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sqlQuery(adoquery1, 'select * from t1 where name = %s or id = %d', [QuotedStr('1'), 2]);
end;