数据库:access
table 里有一个日期型的字段d1
sql文:select * from table where d1=2000/2/2
有这条记录,但是取不出来,为什么,大家帮忙.

解决方案 »

  1.   

    用format函数转换一下这个值“2000/2/2”成日期形式后在查询
      

  2.   

    select * from table where d1='2000/2/2'
      

  3.   

    试试sql:select * from table where d1='2000/2/2'
      

  4.   

    加引号的不错,报错是mismatch
    数据库里的格式是:yyyy-mm-dd
    但是我改成-了,也还是不对,不知道改怎么办了,大家再想办法啊
      

  5.   

    select * from table where datediff('y',#2000/2/2#,dl)=0
      

  6.   

    检查两个方面:一、在区域设置中看一下你的格式是什么样的;二、把日期用#定界符隔开。eg: select * from table where d1=#2002-2-2#
      

  7.   

    select * from table where format(d1,"yyyy-mm-dd")="2003-02-02"
      

  8.   

    strSQL="select * from table where d1='#" & cdate("2000/2/2") & "#'"
    rs.open strSQL.......................(后面的参数自己添)