(1).文件edit.asp,這個文件沒有什么好講的了,因為基本上和本系統的addarticle.asp程序是相同的,只有在文章標題和文章內容部分取了相應的數據庫內容,以方便大家參考修改。 <!--#include file="conn.asp"--> <% if request.cookies("adminok")="" then response.redirect "login.asp" end if %> <html>
"打開數據庫連接 <!--#include file="conn.asp"--> "打開對文章內容的代碼進行轉化文件 <!--#include file="inc/articlechar.inc"--> <% if request.cookies("adminok")="" then response.redirect "login.asp" end if %> <% dim typename dim title dim content dim sql dim rs dim articleid title=htmlencode2(request.form("txttitle")) content=htmlencode2(request.form("txtcontent")) articleid=request("id") "打開數據庫指定記錄集中的指定記錄,并對其進行更新操作 set rs=server.createobject("adodb.recordset") sql="select * from article where articleid="&articleid rs.open sql,conn,3,3 "請注意:這里并沒有加入rs.addnew表示只是對數據庫的指定記錄進行更新操作,而沒有添加新的記錄 rs("title")=title rs("content")=content rs("dateandtime")=date() "更新數據庫 rs.update "關閉數據庫連接 rs.close set rs=noting conn.close set conn=nothing "對數據庫更新完畢后,把頁面重新轉向文章管理頁面manage.asp response.redirect "manage.asp" %>