首页 > 代码库 > access 数据库 按日期类型查询数据 报错!

access 数据库 按日期类型查询数据 报错!

<span style="font-size:18px;">select * from sv_JFVoucher  
where isDelete=0 
 and  [date]>= '2015-1-20 0:00:00'
  and  [date]<= '2015-1-20 0:00:00' 
  order by id desc</span>

 这条sql 语句在SqlServer08中执行是无错误的,可是在access数据库中执行就报错!

百度了一下,说把 

<span style="font-size:18px;"><span style="color:#ff6666;">'2015-1-20 0:00:00'</span> 修改成 </span><pre name="code" class="sql"><span style="font-size:18px;color:#ff0000;">#2015-1-20 0:00:00#</span>
<span style="font-size:18px;"></span>


<span style="font-size:18px;">select * from sv_JFVoucher  
where isDelete=0 
 and  [date]>= #2015-1-20 0:00:00#
  and  [date]<= #2015-1-20 0:00:00# 
  order by id desc</span>

<span style="font-size:18px;">运行真的成功了,我刚接触access,表示不解</span>

  

access 数据库 按日期类型查询数据 报错!