用StrToDate先将字符串转换成日期型,然后再比较

解决方案 »

  1.   

    用FormatDateTime把数据库中数据转换成字符串和输入的日期比较
      

  2.   

    SQL没有这个功能吗???????
      

  3.   

    sql.add('Select * From old.db Where (date3 between  :stratdate and :enddate) ');
    ParamByName('stratdate').asdate:= StrToDate(date1);
    ParamByName('enddate').asdate:= StrToDate(date2);
      

  4.   

    // SearchStartTime和SearchEndTime是输入的MaskEdit编辑框
    // IO_TIME是数据库表中的TimeStamp格式
    // 下面程序如何改啊?数据库显示是用DBGrid控件来做的
    // 多谢各位了
      with dm_main.T_attendance do
      begin
        cond := '';
        Close;
        if SeekByPerson.Checked then  // 选中按员工找
          cond := 'PERSON=''' + SearchPersonID.Text + '''';
        if SeekByTime.Checked then // 选中按时间范围找
        begin
          if length( cond ) >0 then  // 两个条件可以是AND与的关系
            cond := cond + ' AND ';
          cond := cond + 'IO_TIME >=''' + SearchStartTime.Text + '''';
          cond := cond + 'AND IO_TIME <= ''' + SearchEndTime.Text + '''';
        end;
        if length( cond )>0 then
        begin
          filter := cond;
          filtered := True; // 选了检索条件
        end
        else
          filtered := False; // 没有选检索条件
        Open;
     
      

  5.   

    利用between判断一下,看行不行!