我用一个时间组件:DATETIMEPICKER 与ACESS数据库中的一个时间字段进行查询,老是出错,请高手指点。我用的语句:
sqlstr := 'select * from questions where publishtime>=DateValue('''+DateToStr(datetimepicker1.Date)+''')'

解决方案 »

  1.   

    sqlstr := 'select * from questions where publishtime>=#' + DateToStr(datetimepicker1.Date) + '#';
      

  2.   

    sqlstr := 'select * from questions where publishtime>=#' + FormatDateTime('yyyy-MM-dd',datetimepicker1.Date) + '#';
      

  3.   

    什么提示信息?你的publishtime字段是日期类型吗?
      

  4.   

    sqlstr := 'select * from questions where publishtime>=#' + DateToStr(datetimepicker1.Date) + '#';是什么错误呀这个行的
      

  5.   

    我可能要补充一句,我用的.db数据库,应该不是ACESS,平常我都用ACESS打开。以上的语句提示:“project anserterminal.exe raised exceptions class EDBEngineError with message'Invalid use of keyword.
    Token: publishtime>=
    Line Number:1'. Process stopped. Use step or Run to continue."
      

  6.   

    数据库用ACESS打开,PUBLISHTIME的属性为:日期/时间,举例:2007-5-30
      

  7.   

    sqlstr是个文本类型问题显而易见
      

  8.   

    sqlstr := 'select * from questions where publishtime >= CDate(FormatDateTime('yyyy-MM-dd',datetimepicker1.Date))
    是这样吗?试试对吗?
      

  9.   

    delphi adoquery如何调用access中的查询????各位帮忙!!!