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

一个数据更新的问题
<%
dim   conn      
dim   connstr
db= "../Database/data.mdb "
on   error   resume   next
connstr= "DBQ= "+server.mappath( " "&db& " ")+ ";DefaultDir=;DRIVER={Microsoft   Access   Driver   (*.mdb)}; "
set   conn=server.createobject( "ADODB.CONNECTION ")
conn.open   connstr
dim   rs
set   rs=server.createobject( "adodb.recordset ")
rs.open   "select   *   from   Content   where   contenttitle= 'aboutus ' ",conn,1,1
%> <form   action= "adminaboutus.asp "   mothed=post>
<div   class= "RoundedCornercontent ">
<b   class= "rtopcontent "> <b   class= "r1content "> </b> <b   class= "r2content "> </b> <b   class= "r3content "> </b> <b   class= "r4content "> </b> </b>
<div   align= "center ">
<table   border= "0 "   width= "99% "   cellspacing= "0 "   cellpadding= "0 ">
<tr   valign=top>
<td>
<p   style= "line-height:   150%;   margin-left:   50px "> <b> <font   size= "4 ">
<br/>
About   Us <br/>
<br/>
</font> </b> <input   type= "hidden "   name= "contenttitle "     value= "aboutus "   size= "20 ">
<textarea   rows= "10 "   name= "content "   cols= "60 "> <%=rs( "content ")%> </textarea> <br/>
<br/>
<input   type= "submit "   value= "Update "   name= "Submit "> <br/>
<br/>
  </td>
</tr>
</table>
</div>
<%
rs.close
conn.execute( "update   Content   set   content= ' "   &   request.form( "Content ")   &   " '   where   contenttitle= 'aboutus ' ")
%>

可是当我提交后,数据还是没有更新,反而是数据没有了,请问这个是怎么回事呢?

------解决方案--------------------
<%
dim conn,page
dim connstr,content
db= "../Database/data.mdb "
on error resume next
connstr= "DBQ= "+server.mappath( " "&db& " ")+ ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
set conn=server.createobject( "ADODB.CONNECTION ")
conn.open connstr
page=clng(request( "page "))
select case page
case 0
dim rs
set rs=server.createobject( "adodb.recordset ")
rs.open "select content from Content where contenttitle= 'aboutus ' ",conn,1,1
content=rs( "content ")
rs.close
set rs=nothing
%>
<form action= "adminaboutus.asp " mothed=post>
<input type= "hidden " name= "page " value=1>
<div class= "RoundedCornercontent ">
<b class= "rtopcontent "> <b class= "r1content "> </b> <b class= "r2content "> </b> <b class= "r3content "> </b> <b class= "r4content "> </b> </b>