程序如下
var
a,b:tdatetime;
s:string;
begin
a:=datetimepicker1.date;
b:=datetimepicker2.date;
s:=dbcombobox1.text;
adoquery1.active:=true;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select sum(造型次数) from yydd where 拍摄时间 between a
and b and 化妆师=:l');
adoquery1.open;
dbgrid1.refresh;
end;
执行程序后系统提示错误未发现参数b
我相知到这是怎么回事 请高手指教 我急着用 拜谢各位了
var
a,b:tdatetime;
s:string;
begin
a:=datetimepicker1.date;
b:=datetimepicker2.date;
s:=dbcombobox1.text;
adoquery1.active:=true;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select sum(造型次数) from yydd where 拍摄时间 between a
and b and 化妆师=:l');
adoquery1.open;
dbgrid1.refresh;
end;
执行程序后系统提示错误未发现参数b
我相知到这是怎么回事 请高手指教 我急着用 拜谢各位了
and :b and 化妆师=:l');
adoquery1.Parameters.ParamByName('a').Value:=a;
adoquery1.Parameters.ParamByName('b').Value:=b;
adoquery1.Parameters.ParamByName('l').Value:=s;
adoquery1.open;
var
a,b:tdatetime;
s:string;
begin
a:=datetostr(datetimepicker1.date);
b:=datetostr(datetimepicker2.date);
s:=dbcombobox1.text;
adoquery1.active:=true;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select sum(造型次数) from yydd where 拍摄时间 between '+a+'
and '+b+' and 化妆师=:l');
adoquery1.open;
dbgrid1.refresh;
end;
试试
a,b:tdatetime;
s:string;
begin
a:=datetimepicker1.date;
b:=datetimepicker2.date;
s:=dbcombobox1.text;
adoquery1.active:=true;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select sum(造型次数) from yydd where 拍摄时间 between :time1
and :time2 and 化妆师=:N');
adoquery1.Parameters.ParamByName[0].Value:=a;
adoquery1.Parameters.ParamByName[1].Value:=b;
adoquery1.Parameters.ParamByName[2].value:='1';adoquery1.open;
dbgrid1.refresh;
end;