www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > admin/admin_announcesave.asp

    <%CheckAdmin2%>
<!--#include file="const.asp"-->
<%
ID=request.QueryString("id")
Title=request.form("Title")
Author=request.form("Author")
DateAndTime=request.form("DateAndTime")
if DateAndTime="" then DateAndTime=now()
Content=request.form("Content")
founerr=false
act=request("act")
if trim(Content)="" then
	founderr=true
	errmsg="<li>公告内容不能为空</li>"
end if
if founderr=true then
	call error()
else
	set rs=server.createobject("adodb.recordset")
	if act="edit" then
		sql="select * from Announce where ID="&ID
	elseif act="add" then
		sql="select * from Announce"
	else
		response.write "操作错误!"
		response.end
	end if
	rs.open sql,conn,1,3
	if act="add" or act="edit" then
		if act="edit" then
			if rs.eof then
				response.write "操作错误"
				Response.End 
			end if
		end if
		if act="add" then
			rs.addnew
		end if
		if Title="" then
			rs("Title")=null
		else
			rs("Title")=Title
		end if
		if Author="" then
			rs("Author")=null
		else
			rs("Author")=Author
		end if
		rs("DateAndTime")=DateAndTime
		rs("Content")=Content
		rs.update
	end if
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Redirect "admin_AnnounceMana.asp"
end if
%>