query1.close;
query1.sql.clear;
query1.sql.add('select * from table where year(rq)>=:da');
--------------------------------------------------------------------
query1.parambyname('da').asdatetime:=dateedit1.date;//控件时间
query1.open;

解决方案 »

  1.   

    query1.close;
    query1.sql.clear;
    query1.sql.add('select * from table where year(rq)>=year(:mdate)');
    --------------------------------------------------------------------
    query1.parambyname('mdate').asdatetime:=dateedit1.date;//控件时间
    query1.open;
      

  2.   

    should be:query1.sql.add('select * from table where year(rq)>=year(:mdate)');
      

  3.   

    query1.close;
    query1.sql.clear;
    query1.sql.add('select * from table where year(rq)>=year(:mdate)');
    query1.Params.Clear;//加上这句
    query1.Params.ParseSQL(query1.Text,True);//加上这句
    query1.parambyname('mdate').asdatetime:=dateedit1.date;//控件时间
    query1.open;
      

  4.   

    query1.close;
    query1.sql.clear;
    query1.sql.add('select * from table where year(rq)>=:mdate');
    --------------------------------------------------------------------
    query1.parambyname('mdate').asinteger:=yearof(dateedit1.date);//控件时间
    query1.open