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

📄 del.asp

📁 简单的网站
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/cnn2.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="error.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  If (Not MM_abortEdit) Then
    ' execute the delete
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_cnn2_STRING
    MM_editCmd.CommandText = "DELETE FROM tuser WHERE id = ?"
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, Request.Form("MM_recordId")) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "browse.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If

End If
%>
<%
Dim rs1__MMColParam
rs1__MMColParam = "1"
If (Request.QueryString("id") <> "") Then 
  rs1__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim rs1
Dim rs1_cmd
Dim rs1_numRows

Set rs1_cmd = Server.CreateObject ("ADODB.Command")
rs1_cmd.ActiveConnection = MM_cnn2_STRING
rs1_cmd.CommandText = "SELECT * FROM tuser WHERE id = ?" 
rs1_cmd.Prepared = true
rs1_cmd.Parameters.Append rs1_cmd.CreateParameter("param1", 5, 1, -1, rs1__MMColParam) ' adDouble

Set rs1 = rs1_cmd.Execute
rs1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户资料管理系统-删除页面</title>
<style type="text/css">
<!--
@import url("../css/table.css");
-->
</style>
</head>

<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="bg1"><div align="center">用户资料管理系统——删除资料</div></td>
  </tr>
  <tr>
    <td class="fk_table"><form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
      <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#990099">
        <tr>
          <td width="70" bgcolor="#99FFFF"><div align="center">姓 名</div></td>
          <td bgcolor="#99FFFF"><label>
            <%=(rs1.Fields.Item("name").Value)%>            </label></td>
        </tr>
        <tr>
          <td bgcolor="#99FFFF"><div align="center"> 性 别</div></td>
          <td bgcolor="#99FFFF"><label></label><label><%=(rs1.Fields.Item("sex").Value)%></label></td>
        </tr>
        <tr>
          <td bgcolor="#99FFFF"><div align="center">生 日</div></td>
          <td bgcolor="#99FFFF"><label>
            <%=(rs1.Fields.Item("birthday").Value)%>
            <div align="center"></div>
            </label></td>
        </tr>
        <tr>
          <td bgcolor="#99FFFF"><div align="center">电 话</div></td>
          <td bgcolor="#99FFFF"><label><%=(rs1.Fields.Item("tel").Value)%>
            </label></td>
        </tr>
        <tr>
          <td bgcolor="#99FFFF"><div align="center">地 址</div></td>
          <td bgcolor="#99FFFF"><label>
            <%=(rs1.Fields.Item("address").Value)%>
            <div align="center"></div>
            </label></td>
        </tr>
        <tr>
          <td bgcolor="#99FFFF"><div align="center"></div></td>
          <td bgcolor="#99FFFF"><label>
            <input type="submit" name="button" id="button" value="删除" />
          </label>
            <label></label></td>
        </tr>
      </table>
        
            <input type="hidden" name="MM_delete" value="form1" />
      <input type="hidden" name="MM_recordId" value="<%= rs1.Fields.Item("id").Value %>" />
    </form>
    </td>
  </tr>
  <tr>
    <td class="bg1"><div align="center">用户资料管理系统&copy;版权所有</div></td>
  </tr>
</table>
</body>
</html>
<%
rs1.Close()
Set rs1 = Nothing
%>

⌨️ 快捷键说明

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