答案不唯一:
with query1 do
begin
close;
sql.clear;
unprepared;
sql.add('select 显示的字段名 from 表名 where 条件');
if not(prepared) then
prepared;
open;
end;
这是一般模式!
with Qry do
begin
SQL.Clear;
SQL.Add('select * from runbase.. fundlogs where i_fund_account=:i_fund_account')
SQl.Add(' and i_date>=:sStartDate + '" and i_date<=:sEndDate' );
Parambyname('i_fund_account').asinteger:=i_fund_account;
Parambyname('StartDate').asdatetime:=strtodatetime(sStartDate);
Parambyname('EndDate').asdatetime:=strtodatetime(sEndDate);
Prepare;
Open;
end;