Access按时间查询

1.Access数据表日期字段同日期字符串直接比较

以下是查询2012年12月12日以后的数据的SQL语句。:

select * from TblName where DFDate>#2012-12-12#

 

2.Access数据表日期字段同日期类型变量直接比较

这种方法其实等同于方法一,以下是查询比当前日期(如2012-12-12)早10天的数据的SQL语句。

DateTime queryDate=DateTime.Now.AddDays(-10);
string sql = "select * from TblName where DFDate>#"+queryDate+"#";

posted @ 2021-02-28 17:00  Bruce_Sun  阅读(450)  评论(0)    收藏  举报