delphi+access 用ADO连接,为什么在SQL语句中用SUM()时,执行出错?
难道ACCESS不支持这个函数????
     with datamodule22.ADOQuery2 do
       begin
          close;
          sql.clear;
          sql.add('select * from dayrecord where carno=:jcar and year(rq)=:y and month(rq)=:m');
         // sql.add('select carno,sum(zcgls) as zcgls1,sum(rkgls) as rkgls1,sum(lqh) as lqh1,sum(oil) as oil1,sum(sl) as sl1,sum(zcgls*sl) as dgl,sum(sl*yj) as ysfy from dayrecord where carno=:jcar and year(rq)=:y and month(rq)=:m');
//用上这句就出错,提示是sum()操作符丢失
          Parameters.ParamByName('jcar').Value:=g_carno;      // 车号
          Parameters.ParamByName('y').Value:=yyear;      //年
          Parameters.ParamByName('m').Value:=mmonth;      //月
          open;
          while not eof do
            begin
              tosl:=tosl+FieldValues['carno'];
              tozc:=tozc+FieldValues['zcgls'];
              tork:=tork+FieldValues['rkgls'];
              tod:=tod+FieldValues['zcgls']*FieldValues['sl'];
              toyf:=toyf+FieldValues['yj']*FieldValues['sl'];
              tolq:=tolq+FieldValues['lqh'];
              torl:=torl+FieldValues['oil'];
              next;
            end;
       end;