使用變體開放數組實現通用查詢(array of const)
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;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2010/02/03/2940742.html