if session("admin_name")="" then
response.redirect "default.asp"
end if
dim id,act,DateAndTime,Content,sql,i
ID=request.QueryString("id")
Title=trim(request.form("Title"))
Title_fname=trim(request.form("Title_fname"))
Title_ename=trim(request.form("Title_ename"))
act=request("act")
if DateAndTime="" then DateAndTime=now()
Content=trim(request.form("Content"))
if Title="" then
response.write ""
response.write("")
response.write("对不起,投票主题不能为空!")
response.write(" 回去重来,2秒钟后自动返回")
response.write("")
response.end
Response.End
end if
set rs=server.createobject("adodb.recordset")
if act="edit" then
sql="select * from vote where ID="&ID
elseif act="add" then
sql="select * from vote"
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.write("")
response.write("操作错误!")
response.write(" 回去重来,2秒钟后自动返回")
response.write("")
Response.End
end if
end if
if act="add" then rs.addnew
rs("Title")=Title
rs("Title_fname")=Title_fname
rs("Title_ename")=Title_ename
'rs("depid")=session("UserDepID")
for i=1 to 5
'if request("select"&i)"" then
rs("select"&i)=request("select"&i)
rs("select_fname"&i)=request("select_fname"&i)
rs("select_ename"&i)=request("select_ename"&i)
if request("answer"&i)="" then
rs("answer"&i)=0
else
rs("answer"&i)=request("answer"&i)
'end if
end if
next
rs("dateandtime")=now()
rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect "voteManage.asp"
%>