bumen_add.asp
上传用户:xhjd888
上传日期:2022-07-20
资源大小:203k
文件大小:3k
源码类别:

.net编程

开发平台:

Visual Basic

  1. <!--#include file="../add/ocdb/ocdb.asp"-->
  2. <%
  3. response.buffer=true
  4. '设定子程序
  5. select case Request("action")
  6. case "add"
  7. call add()
  8. case "edit"
  9. call edit()
  10. case "del"
  11. call del()
  12. end select
  13. '设定填加信息子程序
  14. sub add()
  15. addsub=request("csubname")
  16. set rs=conn.execute("select top 1 id from class order by id desc")
  17. if rs.eof then
  18. id=0
  19. else
  20. id=rs("id")
  21. end if
  22. rs.close
  23. sql="select * from class"
  24. set rs=server.createobject("adodb.recordset")
  25. rs.open sql,conn,1,3
  26. rs.addnew
  27. rs("id")=id+1
  28. rsid=id+1
  29. rs("cname")=trim(request("cname"))
  30. if request("lanmu")="" then
  31. rs("cwar")=0
  32. rs("cone")="NULL"
  33. rs("csub")=rsid
  34. rs("lmcd")=rsid
  35. rs("endclass")=0
  36. else
  37. sql1="select * from class where id="&request("lanmu")&""
  38. set rs1=server.createobject("adodb.recordset")
  39. rs1.open sql1,conn,1,3
  40. rs("id")=rsid
  41. rs("csub")=rs1("csub")
  42. rs("cwar")=rs1("cwar")+1
  43. rs("cone")=rs1("id")
  44. rs("lmcd")=rs1("lmcd")&"."&rsid
  45. rs("endclass")=0
  46. rs1("endclass")=1
  47. rs1.update
  48. rs1.close
  49. set rs1=nothing
  50. end if
  51. rs("cdate")=sj
  52. rs.update
  53. rs.close
  54. set rs=nothing
  55. '记录history
  56. logsys("添加栏目")
  57. conn.close
  58. set conn=nothing
  59. response.write"<script>alert('部门添加完成!返回部门添加');window.location='bumen.asp'</script>"
  60. response.end()
  61. end sub
  62. '设定修改信息子程序
  63. sub edit()
  64. set rs=server.createobject("ADODB.recordset") 
  65. rs.Open "SELECT * FROM class where id="&request("id"),conn,1,3 
  66. rs("cname")=trim(request("cname"))
  67. if request("csubname")="0" then
  68. rs("cwar")=0
  69. rs("cone")="NULL"
  70. set xx=conn.execute("select top 1 csub from class order by csub desc")
  71. if xx.eof or xx.bof or rs(0)="" then
  72. rs("csub")=1
  73. else
  74. rs("csub")=(xx(0)+1)
  75. end if
  76. set xx=nothing
  77. else
  78. set xx=conn.execute("select csub from class where cname='"&request("csubname")&"'")
  79. rs("csub")=xx(0)
  80. set xx=nothing
  81. rs("cwar")=1
  82. rs("cone")=(request("csubname"))
  83. end if
  84. if request("cuser")="0" then
  85. rs("cuser")=admin
  86. else
  87. rs("cuser")=(request("cuser"))
  88. end if
  89. if request("cinput")="" then
  90. rs("cinput")=admin
  91. else
  92. rs("cinput")=trim(request("cinput"))
  93. end if
  94. if request("caccount")<>"" then
  95. rs("caccount")=request("caccount")
  96. end if
  97. rs.update
  98. rs.close
  99. '记录history
  100. logsys("修改栏目")
  101. conn.close
  102. set conn=nothing
  103. response.redirect "class_edit.asp"
  104. end sub
  105. '设定删除子程序
  106. sub del()
  107. dim id,sql,cname
  108. id=request("id")
  109. cwar=request("cwar")
  110. cname=request("cname")
  111. if cwar = "0" then
  112. sql="delete * from class where trim(Cstr(ID))='"&id&"'"
  113. conn.execute(sql)
  114. sql="delete * from class where trim(Cstr(cone))='"&cname&"'"
  115. conn.execute(sql)
  116. else
  117. sql="delete * from class where trim(Cstr(ID))='"&id&"'"
  118. conn.execute(sql)
  119. end if
  120. '记录history
  121. logsys("删除栏目")
  122. Conn.Close
  123. Set Conn=Nothing
  124. response.redirect "class_edit.asp"
  125. end sub
  126. %>