我的sql...
 where ...
 ...offerform.date=2002-10-8 and ....总是提示时间有问题,应该怎么写呢?

解决方案 »

  1.   

    where ....
    ....offerform.date=to_date('2002-10-08')就行了
      

  2.   

    不行  错误提示它说’to_date函数为定义!‘
      

  3.   

    where ...
     ...offerform.date=StrToDate(2002-10-8);
      

  4.   

    offerform.date = ts{'2002-10-08'}
      

  5.   

    在Delphi中将其转为str
    querey1.sql.add('select * from tbname where timefield='+quotedstr(datetostr(datetimepicker.date)))
      

  6.   

    还是不行  我是这么做的先生成string类型的sql语句...
    if label2.caption<>''
           then
             begin
           sqls:=format(' %s %s offerform.时间=ts{%s}',[sqls,sep,label2.caption]);
    或是
    sqls:=format(' %s %s offerform.时间=to_date(%s)',[sqls,sep,label2.caption]);//都不行
           sep:='and';
               end;   
    ...
    其中label2.caption就是由date类型的转换过来的例如 2002-10-2然后在由 ADOSQL.SQL.Add(sqls);
    然后执行。。可是都不好用
      

  7.   

    应该是这样吧:StrToDate('2002-10-08','yyyy-mm-dd')
      

  8.   

    你在哪用,如果是在源程序里写不能用TO_DATE只能用STRTODATE
      

  9.   

    querey1.sql.add('select * from tbname where timefield='+datetostr(datetimepicker.date))
    就这样把它征服
      

  10.   

    用参数化查询都可以
    offerform.date=:date
    parambyname('date').asstring:='2002-10-21';