vote_save.asp
上传用户:xxtaishan
上传日期:2022-01-02
资源大小:4063k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

ASP/ASPX

  1. <!--#include file="vote_conn.asp"-->
  2. <%
  3. if request("id")<>"del" then
  4.     err=0
  5.     title=request("title")
  6.     if title="" then
  7.         err=1
  8.         error=error+"标题不能为空n"
  9.     end if
  10.     a=0
  11.     for i=1 to request("choose").count
  12.         if request("choose")(i)="" then
  13.         exit for
  14.         end if
  15.         a=a+1
  16.     next
  17.     if a=0 then
  18.         err=1
  19.         error=error+"选择内容不能为空n"
  20.     end if
  21.     if err=1 then
  22.         response.write "<script>alert('"&error&"');</script>"
  23.         response.write "<script>history.back(1);</script>"
  24.         response.end
  25.     end if
  26. end if
  27. if request("id")="xg" then '调查修改
  28.     conn.execute("update class set title='"&title&"',style='"&request("style")&"' where     id="&request("classid"))
  29.     conn.execute("delete from vote where class="&request("classid"))
  30.     for i=1 to request("choose").count
  31.         if request("choose")(i)<>"" then
  32.             conn.execute("insert into vote (vote,color,class) values ('"&request("choose")(i)&"','"&request("color")(i)&"',"&request("classid")&")")
  33.         else
  34.             exit for
  35.         end if
  36.      next
  37.      response.write "<script>alert('修改调查成功');</script>"
  38.      response.write "<script>location.href='vote_list.asp';</script>"
  39. elseif request("id")="del" then '调查删除
  40.      conn.execute("delete from vote where class="&request("classid"))
  41.      conn.execute("delete from class where id="&request("classid"))
  42.      response.write "<script>alert('删除调查成功');</script>"
  43.      response.write "<script>location.href='vote_list.asp';</script>"
  44. else
  45.      conn.execute("insert into class (title,style) values ('"&title&"','"&request("style")&"')")
  46.      set rs=server.createobject("adodb.recordset")
  47.      sql="select top 1 * from class where title='"&title&"' order by id desc"
  48.      rs.open sql,conn,3,1
  49.      classid=rs("id")
  50.      rs.close
  51.      set rs=nothing
  52.      for i=1 to request("choose").count
  53.          if request("choose")(i)<>"" then
  54.              conn.execute("insert into vote (vote,color,class) values ('"&request("choose")(i)&"','"&request("color")(i)&"',"&classid&")")
  55.          else
  56.              exit for
  57.          end if
  58.      next
  59.          response.write "<script>alert('添加调查成功');</script>"
  60.          response.write "<script>location.href='vote_list.asp';</script>"
  61. end if
  62. conn.close
  63. set conn=nothing
  64. %>