📄 delete.asp
字号:
<title>删除</title>
<!--#include file="../inc/config.asp"-->
<!-- #include file="Login_Check.asp" -->
<%
n=request.QueryString("n")
id=request.QueryString("id")
if n=1 then
keer="delete * from [Admin] where [admin_id]="&id
application.Lock()
conn.execute(keer)
application.UnLock()
call ShowErr("管理员已被删除!","Admin_List.asp")
elseif n=2 then
sqlstr="select * from [Route] where route_id="&id
rs.open sqlstr,conn,1,3
route_name=rs("route_name")
route_address=rs("route_address")
rs.close
route_address_old=split(route_address,"-")
Num_1=ubound(route_address_old)
for i=0 to Num_1
sql="select * from [Station] where station_name='"& route_address_old(i) &"'"
rs.open sql,conn,1,3
station_bus_old_1=rs("station_bus") '读出数据station_bus并进行拆分
station_bus_old_2=split(station_bus_old_1,"-")
Num_2=ubound(station_bus_old_2)
if Num_2=0 then '如果拆分出来的数组只有一个元素,则进行删除操作
keer="delete * from [Station] where [station_name]='"& route_address_old(i) &"'"
application.Lock()
conn.execute(keer)
application.UnLock()
rs.close
end if
if Num_2=1 then '如果是两个元素,进行分析
if station_bus_old_2(0) <> route_name then
station_bus_new=station_bus_old_2(0) '和提交上来的线路名称不同,则把他赋给一个变量。
else '否则把另外一个值赋给变量
station_bus_new=station_bus_old_2(1)
end if
rs("station_bus")=station_bus_new
rs.update
rs.close
end if
if Num_2>1 then '如果大于两个元素,进行更为复杂的分析
if station_bus_old_2(0) <> route_name then
station_bus_new=station_bus_old_2(0)
for j=1 to Num_2
if station_bus_old_2(j) <> route_name then
station_bus_new=station_bus_new+"-"+station_bus_old_2(j)
end if
next
else
station_bus_new=station_bus_old_2(1)
for j=2 to Num_2
station_bus_new=station_bus_new+"-"+station_bus_old_2(j)
next
end if
rs("station_bus")=station_bus_new
rs.update
rs.close
end if
next
keer="delete * from [Bus] where [bus_name]='"& route_name &"'"
application.Lock()
conn.execute(keer)
application.UnLock()
keer="delete * from [Route] where [route_id]="&id
application.Lock()
conn.execute(keer)
application.UnLock()
call ShowErr("该公交车线路已被删除!","Admin_Route_List.asp")
elseif n=3 then
keer="delete * from [Message] where [message_id]="&id
application.Lock()
conn.execute(keer)
application.UnLock()
call ShowErr("该留言信息已被删除!","Admin_Message_List.asp")
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -