delsort.asp

来自「商务网站,信息分类,可以搜索加上ACCESS数据库」· ASP 代码 · 共 63 行

ASP
63
字号
<%Option Explicit%>
<!--#include file="functions.asp"-->
<!--#include file="adoconn.asp"-->

<%
dim objRS,sql
dim sortid,parentid
dim id

sortid = Request.QueryString("sortid")
parentid = Request.QueryString("parentid")

if sortid = "" or (not IsNumeric(sortid)) or parentid = "" or (not IsNumeric(parentid)) then
    objConn.Close()
    Set objConn = nothing
    Response.Write("<script language=""JavaScript"">alert(""意外参数错误!"");history.go(-1)</script>")
    Response.End
else
    parentid = Clng(parentid)
end if

objConn.BeginTrans

sql = "delete * from sort where id = " & sortid
objConn.Execute(sql)
Set objRS = Server.CreateObject("ADODB.RecordSet")
if parentid = -1 then
    sql = "select thispath from pathform where (thispath = '" & sortid & "') or (thispath like '" & sortid & chr(44) & "%')"
else
    sql = "select thispath from pathform where (thispath like '%" & chr(44) & sortid & "') or (thispath like '%" & chr(44) & sortid & chr(44) & "%')"
end if
objRS.Open sql, objConn, 3, 4
do while not objRS.EOF
    id = getid(objRS("thispath"))
    sql = "delete * from stationinfo where parentid = " & id        '删除相关网站
    objConn.Execute(sql)
    sql = "delete * from sort where id = " & id                     '删除下属类
    objConn.Execute(sql)
    if parentid <> -1 then
        sql = "delete * from shortcut where sortid = " & id             '删除下属快捷方式
        objConn.Execute(sql)
    end if
    objRS.Delete()
    objRS.MoveNext()
loop
if parentid = -1 then                                               '删除下属快捷方式
    sql = "delete * from shortcut where rootid = " & sortid
    objConn.Execute(sql)
end if
objRS.UpdateBatch()

objConn.CommitTrans

objConn.Close()
Set objConn = nothing
Set objRS = nothing

if parentid = -1 then
    Response.Write("<script language=""JavaScript"">location.replace(""admsort1.asp"")</script>")
else
    Response.Write("<script language=""JavaScript"">location.replace(""admclass.asp?sortid=" & parentid & """)</script>")
end if
%>

⌨️ 快捷键说明

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