⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_del.asp

📁 欢迎使用《雨点下载系统 2.0》! 本系统仅提供给个人网站免费使用
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="chkadmin.asp"-->
<!--#include file="inc/char.asp"-->
<%dim id,sql,rs,Sequence,ParentID
id=CInt(Trim(Request.QueryString("id")))

dim errmsg,founderr
founderr=false

if chkadmin=false or power(5)="0" then
	founderr=true
	errmsg=errmsg+"<li>您没有删除分类的权限</li>"
end if

sql="select ParentID,ChildID,Sequence from Class where ID="&id
set rs=conn.execute(sql)
ParentID=rs(0)
Sequence=rs(2)
if not(isnull(rs(1)) or rs(1)="") then
	founderr=true
	errmsg=errmsg+"<li>此分类还有下级分类,不能删除</li>"
end if
	
if founderr=false then
	conn.execute("update Class set Sequence=Sequence-1 where ParentID="&ParentID&" and Sequence>"&Sequence)
	conn.execute("delete from Class where ID="&id)
	conn.execute("delete from Software where ClassID="&id)
	dim ChildID
	sql="select ID from Class where ParentID="&ParentID&" order by Sequence"
	set rs=conn.execute(sql)
	if rs.eof and rs.bof then
		ChildID=""
	else
		ChildID=CStr(rs(0))
		rs.movenext
		do while not rs.eof
			ChildID=ChildID&","&CStr(rs(0))
			rs.movenext
		loop
	end if
	conn.execute("update Class set ChildID='"&ChildID&"' where ID="&ParentID)
	dim gourl,msg
	gourl="class_list.asp?id="&ParentID
	msg="此分类已删除!"
	call ok()
else
	call error()
end if

set rs=nothing
conn.close
set conn=nothing%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -