日期:2014-05-16  浏览次数:21087 次

access日期的查询
数据库中保存的是
date1
2009-12-31 15:19:00
2009-12-28 15:19:00
2009-05-31 15:19:00
2009-11-31 15:19:00


输入的查询值是2009-12-28

access怎样把这条数据查出来? 

and val(date1) like '%" + dtpStartDate.Value.ToShortDateString() + "%'  

不行





------解决方案--------------------
select * from tt where format(date1,'yyyy-mm-dd')='2009-12-28'
------解决方案--------------------
and int(date1)=#2009-12-28#
------解决方案--------------------
是数据已经取到datatable了,再datatable里再进行查询对吗?
------解决方案--------------------
and date1 BETWEEN #2009-12-28 00:00:00# AND #2009-12-28 23:59:59#

试试看
------解决方案--------------------
date1 BETWEEN #2009-12-28 00:00:00# AND #2009-12-28 23:59:59# 
或 date1 >#2009-12-28 00:00:00# AND datel<#2009-12-28 23:59:59#
------解决方案--------------------
select * from tt where format(date1,'yyyy-mm-dd')='2009-12-28'
------解决方案--------------------
admire!~
too short...