ms access 2007中的日期比较问题 [英] problem with date comparison in ms access 2007
本文介绍了ms access 2007中的日期比较问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友
在我的Windows应用程序中,我试图比较日期。我的查询是
Hello friends
In my windows application i am trying to compare date. my query is as
select someDate from SomeTable where DateValue(somedate) >= #"+fromdate+"# and DateValue(somedate) <= #"+todate+"#
i只有15记录-05-2013。当我选择日期01-01-2013至13-05-2013或01-01-2013至05-05-2013它给我很好的结果
但是当我选择01-01-2013至09-05-2013或01-01-2013至06-05-2013它给我错误。请帮助我。
提前致谢
i have only record at 15-05-2013. when i select date 01-01-2013 to 13-05-2013 or 01-01-2013 to 05-05-2013 it gives me good result
but when i select 01-01-2013 to 09-05-2013 or 01-01-2013 to 06-05-2013 it gives me error. plz help me.
Thanks in advance
推荐答案
要避免此行为,请使用格式功能 [ ^ ]:
To avoid this behavior use Format function[^]:
"select someDate from SomeTable where DateValue(somedate) >= #Format(" + fromdate + ",'yyyy-MM-dd')# and DateValue(somedate) <= #Format(" + todate +",'yyyy-MM-dd')#;"
这篇关于ms access 2007中的日期比较问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文