我有如下程序段:
begin
if comboxMonth.Text=inttostr(2) then
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(29)+#39';
end
else
begin
if ((comboxMonth.Text=inttostr(4))or(comboxMonth.Text=inttostr(6))or(comboxMonth.Text=inttostr(9))or(comboxMonth.Text=inttostr(11))) then
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(30)+#39';
end
else
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(31)+#39';
end;
with aqReport do
begin
close;
sql.Clear;
sql.Add(strsql);
Parameters.ParamByName('strYear').Value:=trim(editYear.Text);
Parameters.ParamByName('strMonth').Value:=trim(comboxMonth.Text);
open;
end;
end;
运行之后。总是出现如下错误提示:aqReport :parameter strYear not found.
我在另一个程序段中曾经用过同样的程序段,运行挺好。这回不知怎么了?
请大家帮忙!
begin
if comboxMonth.Text=inttostr(2) then
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(29)+#39';
end
else
begin
if ((comboxMonth.Text=inttostr(4))or(comboxMonth.Text=inttostr(6))or(comboxMonth.Text=inttostr(9))or(comboxMonth.Text=inttostr(11))) then
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(30)+#39';
end
else
begin
strsql := 'select * from tblHistoryRecords where date>=#39+strYear+#45+strMonth+#45+inttostr(01)+#39 and date<=#39+strYear+#45+strMonth+#45+inttostr(31)+#39';
end;
with aqReport do
begin
close;
sql.Clear;
sql.Add(strsql);
Parameters.ParamByName('strYear').Value:=trim(editYear.Text);
Parameters.ParamByName('strMonth').Value:=trim(comboxMonth.Text);
open;
end;
end;
运行之后。总是出现如下错误提示:aqReport :parameter strYear not found.
我在另一个程序段中曾经用过同样的程序段,运行挺好。这回不知怎么了?
请大家帮忙!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货