小弟有如下一小问题,怎么都解决不了?
运行时,出现如下错误提示:
aqReport:parameter strY not found
清大虾帮忙!
 begin
            strsql := 'select * from tblHistoryRecords where date>=:strY+#45+:strM+#45+inttostr(01)+#39 and date<=:strY+#45+:strM+#45+inttostr(31)+#39';
          end;
          with aqReport do
          begin
            close;
            sql.Clear;
            sql.Add(strsql);
            Parameters.ParamByName('strY').Value:=trim(editYear.Text);
            Parameters.ParamByName('strM').Value:=trim(comboxMonth.Text);
            open;
          end;

解决方案 »

  1.   

    strY,strX又不是数据库里面的字段,
    你这么写
    Parameters.ParamByName('strY').Value:=trim(editYear.Text);
                Parameters.ParamByName('strM').Value:=trim(comboxMonth.Text);
    肯定出错啊
      

  2.   

    参数不是这么用的吧,            sql.Add('select * from tblHistoryRecords where date>=:strY and date<=:strY');
                Parameters.ParamByName('strY').Value:=trim(editYear.Text);
                Parameters.ParamByName('strM').Value:=trim(comboxMonth.Text);
                open;