你的表中redate的类型是什么, 如果是日期型,你可以这样写: select * from studentinfo where redate=#02-06-31# and retype=1 如果是字符型,你应该这样写: select * from studentinfo where redate='02-06-31' and retype=1
select * from studentinfo where redate='2002-06-31' and retype=1
在ACCESS中 select * from studentinfo where redate=#02-06-31# and retype=1
我现在实验了select * from studentinfo where redate=#02-06-31# and retype=1,就查询失败 而select * from studentinfo where redate=#2002-06-31# and retype=1就成功了。 是否ACCESS里面必须使用长日期格式???
最好用长日期格式,最好用FORMAT格式化:dim sql as string sql="select * from studentinfo where redate=#" & format(text1.text,"yyyy-mm-dd") & "# and retype=" & text2.text
如果是日期型,你可以这样写:
select * from studentinfo where redate=#02-06-31# and retype=1
如果是字符型,你应该这样写:
select * from studentinfo where redate='02-06-31' and retype=1
select * from studentinfo where redate=#02-06-31# and retype=1
而select * from studentinfo where redate=#2002-06-31# and retype=1就成功了。
是否ACCESS里面必须使用长日期格式???
sql="select * from studentinfo where redate=#" & format(text1.text,"yyyy-mm-dd") & "# and retype=" & text2.text
可以是:
yyyymmdd
yyyy.mm.dd
yyyy/mm/dd
....