?? delete.asp
字號:
<title>刪除</title>
<!--#include file="../inc/config.asp"-->
<!-- #include file="Login_Check.asp" -->
<%if session("quanxian")=2 then%>
<%
n=request.QueryString("n")
id=request.QueryString("id")
if n=1 then
qm="delete * from [Admin] where [qmadmin_id]="&id
application.Lock()
conn.execute(qm)
application.UnLock()
call ShowErr("管理員已被刪除!","Admin_List.asp")
elseif n=2 then
sqlstr="select * from [Route] where qmroute_id="&id
rs.open sqlstr,conn,1,3
qmroute_name=rs("qmroute_name")
qmroute_address=rs("qmroute_address")
rs.close
qmroute_address_old=split(qmroute_address,"-")
Num_1=ubound(qmroute_address_old)
for i=0 to Num_1
sql="select * from [Station] where qmstation_name='"& qmroute_address_old(i) &"'"
rs.open sql,conn,1,3
station_bus_old_1=rs("qmstation_bus") '讀出數(shù)據(jù)station_bus并進行拆分
station_bus_old_2=split(station_bus_old_1,"-")
Num_2=ubound(station_bus_old_2)
if Num_2=0 then '如果拆分出來的數(shù)組只有一個元素,則進行刪除操作
qm="delete * from [Station] where [qmstation_name]='"& qmroute_address_old(i) &"'"
application.Lock()
conn.execute(qm)
application.UnLock()
rs.close
end if
if Num_2=1 then '如果是兩個元素,進行分析
if station_bus_old_2(0) <> qmroute_name then
station_bus_new=station_bus_old_2(0) '和提交上來的線路名稱不同,則把他賦給一個變量。
else '否則把另外一個值賦給變量
station_bus_new=station_bus_old_2(1)
end if
rs("qmstation_bus")=station_bus_new
rs.update
rs.close
end if
if Num_2>1 then '如果大于兩個元素,進行更為復(fù)雜的分析
if station_bus_old_2(0) <> qmroute_name then
station_bus_new=station_bus_old_2(0)
for j=1 to Num_2
if station_bus_old_2(j) <> qmroute_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("qmstation_bus")=station_bus_new
rs.update
rs.close
end if
next
qm="delete * from [Bus] where [qmbus_name]='"& qmroute_name &"'"
application.Lock()
conn.execute(qm)
application.UnLock()
qm="delete * from [Route] where [qmroute_id]="&id
application.Lock()
conn.execute(qm)
application.UnLock()
call ShowErr("該公交車線路已被刪除!","Admin_qmRoute_List.asp")
elseif n=3 then
qm="delete * from [Message] where [qmmessage_id]="&id
application.Lock()
conn.execute(qm)
application.UnLock()
call ShowErr("該留言信息已被刪除!","Admin_Message_List.asp")
end if
%>
<%else%>
<%
call ShowErr("你沒有權(quán)限!","1")
%>
<%end if%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -