<%if request.form("submit")="change" then
whattitle=request.form("title")
whoauthor=request.form("author")
whatcontent=request.form("content")
id=request.form("id")
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from cnarticle where cn_id="&id
rs.Open sql,conn,3,2
rs("cn_title")=whattitle
rs("cn_author")=whoauthor
rs("cn_content")=whatcontent
rs.update
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
response.redirect("showit.asp")
response.end
%>
<%end if%>
<%
if id<>"" then
Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from cnarticle where cn_id="&id
rs.Open sql,conn,1,1
whattitle=rs("cn_title")
whoauthor=rs("cn_author")
whatcontent=rs("cn_content")
end if
%>
<form action="change.asp" method="post">
Title:<input type="text" name="title" value=<%=whattitle%>><br>
Author:<input type="text" name="author" value=<%=whoauthor%>><br>
Content:<br>
<textarea name="content" rows="8" cols="30"><%=whatcontent%></textarea><br>
<input type="submit" value="change" name="submit">
<input type="reset" value="Reset">
<input name="id" type="hidden" value="<%=id%>">
</form>
当然所有的检察,安全防护都还没做,BUG多多,自己也来慢慢解决。
另外一类的修改更新
<%if request.form("submit")="change" then whattitle=request.form("title") whoauthor=request.form("author") whatcontent=request.form("content") id=request.form("id") sql = "update cnarticle set cn_title='"&whattitle&"',cn_author='"&whoauthor&"',cn_content='"&whatcontent&"' where cn_id="&id conn.Execute(sql) conn.close set conn=Nothing response.redirect("showit.asp") response.end %> |