select * from studentinfo where redate=datevalue('02-06-31') and retype=1

解决方案 »

  1.   

    你的表中redate的类型是什么,
    如果是日期型,你可以这样写:
    select * from studentinfo where redate=#02-06-31# and retype=1
    如果是字符型,你应该这样写:
    select * from studentinfo where redate='02-06-31' and retype=1
      

  2.   

    select * from studentinfo where redate='2002-06-31' and retype=1
      

  3.   

    在ACCESS中
    select * from studentinfo where redate=#02-06-31# and retype=1
      

  4.   

    Access 数据库中的时间日期型字段  必须用 # 号来加以描述 就如 jmlmj(jmlmj)所说的
      

  5.   

    非常感谢上面几位发言,待会一定给分。我还想知道VB里面的日期格式和ACCESS的具体区别有哪些有谁能详细一点告诉我?
      

  6.   

    我现在实验了select * from studentinfo where redate=#02-06-31# and retype=1,就查询失败
    而select * from studentinfo where redate=#2002-06-31# and retype=1就成功了。
    是否ACCESS里面必须使用长日期格式???
      

  7.   

    最好用长日期格式,最好用FORMAT格式化:dim sql as string
    sql="select * from studentinfo where redate=#" & format(text1.text,"yyyy-mm-dd") & "# and retype=" & text2.text
      

  8.   

    为了通用性考虑,数据库中日期字段建议使用字符串的格式
    可以是:
    yyyymmdd
    yyyy.mm.dd
    yyyy/mm/dd
    ....