我用的是sql语句查询access数据库,可是总是数据类型不相符
情各位大侠指教:
access数据库中表名是:表1。有一个字段名是:时间。字段的类型是:‘时间日期’型的。
我用sql语句查询:'select * from 表1 where 时间='''+datetostr(datetimepicker1.date)+''''
就报错说:“标准表达式中的数据类型不匹配”
这是怎么回事啊?

解决方案 »

  1.   

    试试这个
    select * from 表1 where 时间='#'+datetostr(datetimepicker1.date)+''#'
      

  2.   

    还有一个办法
    你的语句可以不改变,改变该时间日期字段为char格式
      

  3.   

    请问楼上的大哥!
    我要查询一个时间段内的记录,如果把日期型的改成char型的怎么查询啊?
    例如:
       “select * from table1 where time between  ? and ?  ”
      

  4.   

    select * from 表1 where 时间 between '#'+datetostr(datetimepicker1.date)+''# and #'+datetostr(datetimepicker2.date)+''#'