我在里面存的数据格式是:2006-7-14 17:21:52现在我在SQL里面用 select * from table_01 where tdate = datevalue('2006-7-14 17:21:52');数据是有的,但是就是找不到,请问应该怎么写呢?

解决方案 »

  1.   

    我不知道datevalue是什么函数。你不妨试试convert(datetime,'2006-7-14 17:21:52')
      

  2.   

    select * from table_01 where tdate = #2006-7-14 17:21:52# 
    这样也不行
      

  3.   

    select tdate from table_01 这t样没有错,select tdate from table_01 where tdate = #2006-7-14 17:21:52# 这样就出错了:parameter 对象被不正确地定义
      

  4.   

    前后加# 说的是select * from table_01 where tdate = datevalue('#2006-7-14 17:21:52#');
      

  5.   

    汗 -_-!! Copy你的Copy错了select * from table_01 where tdate = '#2006-7-14 17:21:52#'
      

  6.   

    偶的神啊,为什么还是错啊select * from table_01 where tdate =  '#2006-7-14 17:21:52#' 这句话还是出错select * from table_01是可以的
      

  7.   

    就用
    select * from table_01 where tdate = #2006-7-14 17:21:52#
    不过要把 ADODataSet/ADOQuery 的 ParamCheck 属性设置为 false
      

  8.   

    to 各位,你们说的我都试了,access字段是日期型的,能insert数据,但是就是不能查找
    ParamCheck 属性设置为 false,还是出错,出错信息是:标准表达式中数据类型不匹配
      

  9.   

    可以了,奇怪一样的代码,就好了select * from table_01 where tdate = #2006-7-14 17:21:52#
    不要加引号
    ParamCheck 属性设置为 false