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

asp+access数据库更新的问题
谁能帮我看看为什么这段代码更新不了,运行完之后能跳到Admin_Index_Main.asp,但是数据库中没有更新为什么,应该不是“文章ID”等于的错误,删除就可以,更新就不行,谁帮我看看,谢谢
===========================================
<!--#include   file= "conn.asp "-->
<%   dim   checkid
dim   rs
      checkid=Request( "checkid ")
      set   rs=server.createobject( "adodb.recordset ")
      sqltext= "select   *   from   Article   where   文章ID= "&INT(checkid)      
      rs.open   sqltext,conn,3,3
     
if   rs.eof   and   rs.bof   then  
Response.Write   "无信息 "  
else    
rs( "文章标题 ")=request.form( "Title ")
rs( "文章简介 ")=request.form( "synopsis ")
rs( "文章来源 ")=request.form( "origin ")
rs( "文章作者 ")=request.form( "writer ")
rs( "文章所属栏目 ")=request.form( "style ")
rs( "文章等级 ")=request.form( "level ")
rs( "发生地区 ")=request.form( "area ")
rs( "文章内容 ")=request.form( "content ")
rs.Update
end   if
rs.close
set   rs=nothing
response.redirect   "Admin_Index_Main.asp "
%>

------解决方案--------------------
checkid=Request( "checkid ")
set rs=server.createobject( "adodb.recordset ")
sqltext= "select * from Article where 文章ID= "&INT(checkid)
----------------------
怎么会在数据查询里做数据转换,在前面完成。改成如下试一下。

checkid=Cint(trim(Request( "checkid ")))
set rs=server.createobject( "adodb.recordset ")
sqltext= "select * from Article where 文章ID= "&checkid
----------------------
------解决方案--------------------
<% dim checkid
dim rs
checkid=Request( "checkid ")
set rs=server.createobject( "adodb.recordset ")
sqltext= "select * from Article where 文章ID= "&INT(checkid)
rs.open sqltext,conn,3,1

if rs.eof and rs.bof then
Response.Write "无信息 "
else
rs( "文章标题 ")=request.form( "Title ")
rs( "文章简介 ")=request.form( "synopsis ")
rs( "文章来源 ")=request.form( "origin ")
rs( "文章作者 ")=request.form( "writer ")
rs( "文章所属栏目 ")=request.form( "style ")
rs( "文章等级 ")=request.form( "level ")
rs( "发生地区 ")=request.form( "area ")
rs( "文章内容 ")=request.form( "content ")
rs.Update
end if
rs.close
set rs=nothing
response.redirect "Admin_Index_Main.asp "
%>

============================================
rs.open sqltext,conn,3,1


如果不可以就用SQL 语句 insert into Article (???) values (??/)