统计一段时间内的数据 .... where 日期 between datetimepicker1.date and datetimepicker2.date
出错了:datetimepicker1没有默认值

解决方案 »

  1.   

    是字符串相加吗
    '... where 日期 between ' + DateTimeToStr(datetimepicker1.date) + ' and ' + DateTimeToStr(datetimepicker2.date)
      

  2.   

    我用adoquery操作考勤表/
    想按编号统计迟到等记录条件是 在莫段时间范围内 表中有日期字段默认值date()并为主索引 我添加了 2个datetimepicker设置开始和结束时间范围
    adoquery1.sql.add('select sum(迟到),编号 from kq where 日期 between datatimepicker1.date and datatimepicker2.date group by 编号')
    出错信息:datatimepicker1.date没有默认值 怎么回事呀 大哥求救!!
    谢谢各位了!
      

  3.   

    adoquery1.sql.add('select sum(迟到),编号 from kq where 日期 between quotedstr(datetostr(datatimepicker1.date)) and quotedstr(datetostr(datatimepicker2.date)) group by 编号')
      

  4.   

    quotedstr什么意思?说没有定义
      

  5.   

    QuotedStr functionReturns the quoted version of a string. (自动给字符串加上引号,就不用烦打了几个'了)UnitSysUtilsCategoryString handling routinesDelphi syntax:function QuotedStr(const S: string): string;C++ syntax:extern PACKAGE AnsiString __fastcall QuotedStr(const AnsiString S);DescriptionUse QuotedStr to convert the string S to a quoted string. A single quote character (') is inserted at the beginning and end of S, and each single quote character in the string is repeated.Note: When working with multi-byte character systems (MBCS), use AnsiQuotedStr instead.