if session("admin")="" then
response.redirect "admin.asp"
end if
%>
dim rs,sql
dim title
dim content
dim articleid
dim classid,Nclassid
dim Nkey
dim writer
dim writefrom
dim errmsg
dim founderr
founerr=false
if trim(request.form("txttitle"))="" then
founderr=true
errmsg="文章名不能为空"
end if
if trim(request.form("txtcontent"))="" then
founderr=true
errmsg=errmsg+"文章内容不能为空"
end if
if founderr=false then
title=htmlencode(request.form("txttitle"))
Nkey=htmlencode(trim(request.form("key")))
classid=request.form("classid")
Nclassid=request.form("Nclassid")
if request("htmlable")="yes" then
content=htmlencode2(request("txtcontent"))
else
content=ubbcode(request.form("txtcontent"))
end if
set rs=server.createobject("adodb.recordset")
if request("action")="add" then
call newsoft()
elseif request("action")="edit" then
call editsoft()
else
founderr=true
errmsg=errmsg+"没有选定参数"
end if
sub newsoft()
sql="select * from article where (articleid is null)"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("Nclassid")=Nclassid
rs("classid")=classid
rs("Nkey")=Nkey
rs("hits")=0
if request.form("writer")"" then
rs("writer")=trim(request.form("writer"))
end if
if request.form("writefrom")"" then
rs("writefrom")=trim(request.form("writefrom"))
end if
rs("dateandtime")=date()
rs.update
articleid=rs("articleid")
end sub
sub editsoft()
sql="select * from article where articleid="&request("id")
rs.open sql,conn,1,3
rs("title")=title
rs("content")=content
rs("Nclassid")=Nclassid
rs("classid")=classid
rs("Nkey")=Nkey
if request.form("writer")"" then
rs("writer")=trim(request.form("writer"))
end if
if request.form("writefrom")"" then
rs("writefrom")=trim(request.form("writefrom"))
end if
rs.update
articleid=rs("articleid")
end sub
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
添加修改文章成功
文章序号为:
文章标题为:
您可以进行其他操作
else
response.write "由于以下的原因不能保存数据:"
response.write errmsg
end if
%>