我想查询两个日期之间的记录.
查询系统时间之前5天到最后的日期....
我的数据库中有日期字段从2007-1-24到2007-2-25,每天一条记录..string bday=DateTime.Now.AddDays(-5).ToShortDateString();
sql="select * from [memo] where 日期 between #"+bday+"# and #9999-12-31#";把系统时间调到2007-2-8,结果这样的数据读出来只有2007-2-3到2007-2-9的记录,以后的记录却读不出!!!请教.怎么解决这问题啊?
查询系统时间之前5天到最后的日期....
我的数据库中有日期字段从2007-1-24到2007-2-25,每天一条记录..string bday=DateTime.Now.AddDays(-5).ToShortDateString();
sql="select * from [memo] where 日期 between #"+bday+"# and #9999-12-31#";把系统时间调到2007-2-8,结果这样的数据读出来只有2007-2-3到2007-2-9的记录,以后的记录却读不出!!!请教.怎么解决这问题啊?
直接用>=
where 日期 >= #" + day +"#"
sql="select * from [memo] where 日期 >='" + bday + "'";
sql="select * from [memo] where 日期 >= #2007-2-1#"; 显示完全正常
sql="select * from [memo] where 日期 >= #2007-2-2#"; 只显示了2007-2-2到2007-2-9
和2007-2-20到2007-2-25
sql="select * from [memo] where 日期 >= #2007-2-3#"; 只显示了2007-2-3到2007-2-9
sql="select * from [memo] where 日期 >= #2007-2-4#"; 只显示了2007-2-4到2007-2-9