Vote_edit.asp
Upload User: ahxunteng
Upload Date: 2022-05-16
Package Size: 1606k
Code Size: 3k
Development Platform:

VBScript

  1. <!--#include file="bsconfig.asp"-->
  2. <%
  3. dim ID,Title,VoteTime,IsSelected
  4. dim rs,sql
  5. ID=request("id")
  6. Title=trim(request.form("Title"))
  7. VoteTime=trim(request.form("VoteTime"))
  8. if VoteTime="" then VoteTime=now()
  9. IsSelected=trim(request("IsSelected"))
  10. if IsSelected="True" then
  11. conn.execute "Update Vote set IsSelected=False where IsSelected=True"
  12. end if
  13. dim i
  14. if ID="" then
  15. Response.Redirect "Vote.asp"
  16. end if
  17. sql="select * from Vote where ID="&Cint(ID)
  18. Set rs= Server.CreateObject("ADODB.Recordset")
  19. rs.open sql,conn,1,3
  20. if not rs.eof then
  21. if Title<>"" then
  22. rs("Title")=Title
  23. for i=1 to 8
  24. if trim(request("select"&i))<>"" then
  25. rs("select"&i)=trim(request("select"&i))
  26. if request("answer"&i)="" then
  27. rs("answer"&i)=0
  28. else
  29. rs("answer"&i)=clng(request("answer"&i))
  30. end if
  31. else
  32. rs("select"&i)=""
  33. rs("answer"&i)=0
  34. end if
  35. next
  36. rs("VoteTime")=VoteTime
  37. rs("VoteType")=request("VoteType")
  38. if IsSelected="" then IsSelected=false
  39. rs("IsSelected")=IsSelected
  40. rs.update
  41. rs.close
  42. set rs=nothing
  43. call CloseConn()
  44. Response.Redirect "Vote.asp"
  45. end if
  46. %>
  47. <!-- #include file="Inc/Head.asp" -->
  48. <BR>
  49. <table cellpadding="2" cellspacing="1" border="0" width="560" align="center" class="a2">
  50. <tr>
  51. <td class="a1" height="25" align="center"><strong>修 改 调 查</strong></td>
  52. </tr>
  53. <tr class="a4">
  54. <td align="center">
  55.       <br>
  56. <form method="POST" action="Vote_edit.asp">
  57.         <table width="500" border="0" align="center" cellpadding="0" cellspacing="2" Class="border">
  58.           <tr class="tdbg"> 
  59. <td width="15%" align="right" bgcolor="#C0C0C0">主题:</td>
  60. <td width="85%" colspan="3" bgcolor="#E3E3E3"><input name="Title" type="text" value="<%=rs("Title")%>" size="52"></td>
  61. </tr>
  62. <% for i=1 to 8%>
  63. <tr class="tdbg"> 
  64. <td align="right" bgcolor="#C0C0C0">选项<%=i%>:</td>
  65. <td bgcolor="#E3E3E3"><input name="select<%=i%>" type="text" value="<%=rs("select"& i)%>" size="36"> 
  66. </td>
  67. <td align="right" bgcolor="#E3E3E3">票数:</td>
  68. <td width="80" bgcolor="#E3E3E3"><input name="answer<%=i%>" type="text" value="<%=rs("answer"&i)%>" size="5"></td>
  69. </tr>
  70. <%next%>
  71. <tr class="tdbg"> 
  72. <td align="right" bgcolor="#C0C0C0">调查类型:</td>
  73. <td colspan="3" bgcolor="#E3E3E3"><select name="VoteType" id="VoteType">
  74. <option value="Single" <% if rs("VoteType")="Single" then %> selected <% end if%>>单选</option>
  75. <option value="Multi" <% if rs("VoteType")="Multi" then %> selected <% end if%>>多选</option>
  76. </select></td>
  77. </tr>
  78. <tr class="tdbg">
  79. <td align="right" bgcolor="#C0C0C0">&nbsp;</td>
  80. <td colspan="3" bgcolor="#E3E3E3">
  81. <input name="IsSelected" type="checkbox" id="IsSelected" value="True" <% if rs("IsSelected")=true then response.write "checked"%>>
  82. 设为最新调查</td>
  83. </tr>
  84. <tr class="tdbg">
  85. <td colspan=4 align=center> <BR>
  86. <input name="ID" type="hidden" id="ID" value="<%=rs("ID")%>"> 
  87. &nbsp;<input name="Submit" type="submit" id="Submit" value="保存修改结果"> </td>
  88. </tr>
  89. </table>
  90. </form>
  91. </td>
  92. </tr>
  93. </table>
  94. <BR>
  95. <%htmlend%>
  96. <%
  97. end if
  98. rs.close
  99. set rs=nothing
  100. conn.close
  101. set conn=nothing
  102. %>