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

这个错误怎么改?
newlist.asp中
<a   href=newmod.asp?id= <%=rs( "id ")%> > 修改 </a>  
newmod.asp为显示新闻ID号为 <%=rs( "id ")%> 内容给予编辑,
newmod_ok.asp为更新数据的文件,其中
<%
id=request.QueryString( "id ")
sql= "update   new   set   title= '&tb1& '   ,zz= '&tb2&   ',tex= '&tb3& ',posttime=now()   where     id= ' "&id& " ' "
set   rs=conn.Execute(sql)
  rs.close
  set   rs   =   nothing
  conn.close
  set   conn   =   nothing
response.write   " <script> alert( '修改成功 ');window.location.href= 'mindex.html '; </script> "
%>
  其中tb1,tb2,tb3为modnew.asp的文本框id
按下modnew.asp提交后出错
提示错误Microsoft   OLE   DB   Provider   for   ODBC   Drivers   (0x80040E07)
[Microsoft][ODBC   Microsoft   Access   Driver]   标准表达式中数据类型不匹配。
我数据库new表的id为自动编号,要怎么改?

------解决方案--------------------
首先,数据的长度不要大于字段长度。
其次,posttime=now() 改成posttime= ' "&now() & " '试一下
------解决方案--------------------
sql= "update new set title= '&tb1& ' ,zz= '&tb2& ',tex= '&tb3& ',posttime=now() where id= "&id
------解决方案--------------------

sql= "update new set title= '&tb1& ' ,zz= '&tb2& ',tex= '&tb3& ',posttime=# "&now()& "# where id= "&id
------解决方案--------------------
id=request.QueryString( "id ")
if id <> " " then
sql= "update new set title= '&tb1& ' ,zz= '&tb2& ',tex= '&tb3& ',posttime=now() where id= "&id& " " '这里不能用单引号。
conn.Execute(sql)
response.write " <script> alert( '修改成功 ');window.location.href= 'mindex.html '; </script> "
end if
response.write " <script> alert( '修改失败 ');window.location.href= 'mindex.html '; </script> "
------解决方案--------------------
sql= "update new set title= '&tb1& ' ,zz= '&tb2& ',tex= '&tb3& ',posttime= ' "&now& " ' where id= "&id
------解决方案--------------------
最简单的方法就是直接输出SQL语句,看看哪里的错误
response.write(sql)
response.end