StartDate     EndDate
2002-01-26    2002-01-30
2002-02-02    2002-02-05
2002-02-07    2002-02-10
2002-02-15    2002-02-17
2002-02-20    2002-02-21
2002-02-25    2002-02-28如输入2002-01-31  则返回假
输入2002-02-16  (因为这个日期在2002-02-15  和  2002-02-17之间),则返回真

解决方案 »

  1.   

    Query1.close;
    Query1.sql.clear;
    Query1.sql.add('select * from table1 where startdate<:vDate and       Endate>:vDate');
    Query1.FieldByName('vDate').asdate:=vDate;
    Query1.Open;
    显示出来的就是你要的记录
      

  2.   

    那么,你做Filter不就是了。
    with DataSet do
    begin
    Filter = 'StartDate < ''2002/1/31'' and EndDate > ''2002/1/31''';//要不要打引号,你自己确认一下
    Filtered := True;
    Result := RecordCount > 0
    end;