Query3.Close;
 Query3.SQL.Clear; Query3.SQL.Add('Select Count(*) From oa_fw_data t where to_char(SCRQ,'+'''+'yyyy-MM-dd'+'''+')=:a');
 Query3.ParamByName('a').Value:=DateToStr(Date());
 Query3.Open;
 Query3.SQL.Add('Select Count(*) From oa_fw_data t where to_char(SCRQ,'+'''+'yyyy-MM-dd'+'''+')=:a');这一句

解决方案 »

  1.   

    Query3.SQL.Add('Select Count(*) From oa_fw_data t where to_char(SCRQ,'+''''+'yyyy-MM-dd'+''''+')=:a');这一句showmessage(query3.sql.text)一下看看
      

  2.   

    to_char这是sqlserver函数

    看看sql.text
    mssql如果是想看当天的记录数这样
    with adoquery1 do
    begin
      close;
      sql.text := 'Select Count(*) From oa_fw_data t where SCRQ=:rq';
      parameters[0].value := FormatDatetime('yyyy-mm-dd',date());
      open;
      showmessage(inttostr(Fields[0].asInteger));
    end;
      

  3.   

    2  楼大虾,请问(SCRQ,'+''''为什么要用四引号??