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

📄 delete.asp

📁 佛山的公交车查询系统
💻 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("管理员已被删除!","qmadmin_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")  '读出数据station_bus并进行拆分
    station_bus_old_2=split(station_bus_old_1,"-")
    Num_2=ubound(station_bus_old_2)
    if Num_2=0 then  '如果拆分出来的数组只有一个元素,则进行删除操作
      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  '如果大于两个元素,进行更为复杂的分析
      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("该公交车线路已被删除!","qmadmin_qmroute_List.asp")
elseif n=3 then
  qm="delete * from [Message] where [qmmessage_id]="&id 
  application.Lock()
  conn.execute(qm)
  application.UnLock()
  call ShowErr("该留言信息已被删除!","qmadmin_Message_List.asp") 
end if
%>
<%else%>
<%
call ShowErr("你没有权限!","1")
%>
<%end if%>

⌨️ 快捷键说明

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