Access中的日期比较、查询需要用#2003-1-1#,就像对字符串是''一样。我用php +access2007
发现代码查询日期死活不通过  (确认是日期字段 rq问题 ,换其他字段都通过的)
代码如下
$db = ADONewConnection('ado_access'); 
$access = realpath('../data.mdb'); 
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'.'DATA SOURCE='. $access . ';'."Jet OLEDB:Database Password=12;"; $db->Connect($myDSN); 
$mtime="2012-12-3";
$mtime = date("#Y-m-d#",$mtime);
$arr=array($LOGIN_USER_NAME,$mtime);
$recordSet = $db->Execute('select username,rq,times,sbzt,xbzt from kq where username=? and rq=?',$arr);
rq是日期短日期类型如2012-12-3 
求解

解决方案 »

  1.   

    $mtime = date("#Y-m-d#",$mtime);
    怎么对呢?
    $mtime = "#$mtime#";date 的第二个参数是 unix时间戳
      

  2.   

    $mtime="2012-12-3";
    $mtime = "#$mtime#";
    $arr=array($LOGIN_USER_NAME,$mtime);
    $recordSet = $db->Execute('select username,rq,times,sbzt,xbzt from kq where username=? and rq=?',$arr);反馈是空白 没有错误 输出测也是空白
    office2007
      

  3.   

    有帖子说$mtime = date("#Y-m-d H:i:s#",mktime(0,0,0,12,1,2012));
    测试错误 空白  $mtime="2012-12-3";
    $mtime = "#$mtime#";
    $arr=array($LOGIN_USER_NAME,$mtime);
    $recordSet = $db->Execute('select username,rq,times,sbzt,xbzt from kq where username=? and rq=?',$arr);反馈是空白 没有错误 输出测也是空白