imagedelt.asp

来自「ASP+SQL Server网络应用系统开发与实例」· ASP 代码 · 共 28 行

ASP
28
字号
<!--#include file="../conndb.asp"-->
<!--#include file="isAdmin.asp"-->
<%
  Dim ImageFile,lid,Num
  '读取线路编号和图片编号
  lid = Request.QueryString("lid")
  Num = Request.QueryString("no")
  '读取指定的线路信息
  Set rs = Server.CreateObject("ADODB.RecordSet")
  Set rs = Conn.Execute("SELECT * FROM Line WHERE LineId=" & lid)
  '如果存在此线路,则删除图片信息
  If Not rs.EOF Then
    '读取图片文件名
    ImageFile = rs("Image" & Num)
    '删除图片
    filename = Server.MapPath("images\"&ImageFile)
    Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
    If (MyFileObject.FileExists(Trim(filename))) Then
      MyFileObject.DeleteFile Trim(filename)
    End If
    '更新表Line中此图片信息
    sql = "UPDATE Line SET Image" & Num & "='', ImageTitle" & Num & "='' WHERE LineId=" & lid
    Conn.Execute(sql)
  End If
  '删除图片后,将页面跳转到编辑页面
  Response.Redirect "LineEdit.asp?lid="&lid
%>

⌨️ 快捷键说明

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