class_add.asp
资源名称:ASP.RAR [点击查看]
上传用户:xhjd888
上传日期:2022-07-20
资源大小:203k
文件大小:3k
源码类别:
.net编程
开发平台:
Visual Basic
- <!--#include file="ocdb/ocdb.asp"-->
- <%
- response.buffer=true
- '设定子程序
- select case Request("action")
- case "add"
- call add()
- case "edit"
- call edit()
- case "del"
- call del()
- end select
- '设定填加信息子程序
- sub add()
- addsub=request("csubname")
- set rs=conn.execute("select top 1 id from class order by id desc")
- if rs.eof then
- id=0
- else
- id=rs("id")
- end if
- rs.close
- sql="select * from class"
- set rs=server.createobject("adodb.recordset")
- rs.open sql,conn,1,3
- rs.addnew
- rs("id")=id+1
- rsid=id+1
- rs("cname")=trim(request("cname"))
- if request("lanmu")="" then
- rs("cwar")=0
- rs("cone")="NULL"
- rs("csub")=rsid
- rs("lmcd")=rsid
- rs("endclass")=0
- else
- sql1="select * from class where id="&request("lanmu")&""
- set rs1=server.createobject("adodb.recordset")
- rs1.open sql1,conn,1,3
- rs("id")=rsid
- rs("csub")=rs1("csub")
- rs("cwar")=rs1("cwar")+1
- rs("cone")=rs1("id")
- rs("lmcd")=rs1("lmcd")&"."&rsid
- rs("endclass")=0
- rs1("endclass")=1
- rs1.update
- rs1.close
- set rs1=nothing
- end if
- rs("cdate")=sj
- rs.update
- rs.close
- set rs=nothing
- '记录history
- logsys("添加栏目")
- conn.close
- set conn=nothing
- response.write"<script>alert('栏目添加完成!返回栏目添加');window.location='class.asp'</script>"
- response.end()
- end sub
- '设定修改信息子程序
- sub edit()
- set rs=server.createobject("ADODB.recordset")
- rs.Open "SELECT * FROM class where id="&request("id"),conn,1,3
- rs("cname")=trim(request("cname"))
- if request("csubname")="0" then
- rs("cwar")=0
- rs("cone")="NULL"
- set xx=conn.execute("select top 1 csub from class order by csub desc")
- if xx.eof or xx.bof or rs(0)="" then
- rs("csub")=1
- else
- rs("csub")=(xx(0)+1)
- end if
- set xx=nothing
- else
- set xx=conn.execute("select csub from class where cname='"&request("csubname")&"'")
- rs("csub")=xx(0)
- set xx=nothing
- rs("cwar")=1
- rs("cone")=(request("csubname"))
- end if
- if request("cuser")="0" then
- rs("cuser")=admin
- else
- rs("cuser")=(request("cuser"))
- end if
- if request("cinput")="" then
- rs("cinput")=admin
- else
- rs("cinput")=trim(request("cinput"))
- end if
- if request("caccount")<>"" then
- rs("caccount")=request("caccount")
- end if
- rs.update
- rs.close
- '记录history
- logsys("修改栏目")
- conn.close
- set conn=nothing
- response.redirect "class_edit.asp"
- end sub
- '设定删除子程序
- sub del()
- dim id,sql,cname
- id=request("id")
- cwar=request("cwar")
- cname=request("cname")
- if cwar = "0" then
- sql="delete * from class where trim(Cstr(ID))='"&id&"'"
- conn.execute(sql)
- sql="delete * from class where trim(Cstr(cone))='"&cname&"'"
- conn.execute(sql)
- else
- sql="delete * from class where trim(Cstr(ID))='"&id&"'"
- conn.execute(sql)
- end if
- '记录history
- logsys("删除栏目")
- Conn.Close
- Set Conn=Nothing
- response.redirect "class_edit.asp"
- end sub
- %>