日期:2014-05-17  浏览次数:20874 次

ACCESS数据库中出现“标准表达式中数据类型不匹配”,奇怪~
Microsoft   JET   Database   Engine   错误   '80040e07 '  

标准表达式中数据类型不匹配。  

/HyMoneyLog.asp,行   25  


相关代码:

dtfrom=trim(request( "dtfrom "))
  dtto=trim(request( "dtto "))
  if   len(dtfrom)=0   then
  dtfrom=year(now)& "- "&   mm   & "-01 "
  end   if
    if   len(dtto)=0   then
  dtto=thistoday
  end   if
 
set   HyRs=server.CreateObject( "adodb.recordset ")
set   HyRs=nothing
set   HyRs=server.CreateObject( "adodb.recordset ")
sql   =   "SELECT   *   from   HyPacketList   where   optime> = ' "   &   dtfrom   & " '   and   optime <= ' "   &   dtto   & " '   order   by   optime   desc "
'Response.Write   sql
'Response.End  
HyRs.Open   sql,conn
j=HyRs.RecordCount  

========应该是日期的问题,AC数据库里类型选择了“时间/日期”

------解决方案--------------------
sql = "SELECT * from HyPacketList where optime> =# " & dtfrom & "# and optime <=# " & dtto & "# order by optime desc "
------解决方案--------------------
楼上正解~