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

📄 delete.asp

📁 Dreamweaver 8网页设计与网站建设 第2版.rar
💻 ASP
字号:
<%@LANGUAGE="JAVASCRIPT"%> 
<!--#include file="../Connections/connGp.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
  MM_editAction += "?" + Request.QueryString;
}

// boolean to abort record edit
var MM_abortEdit = false;

// query string to execute
var MM_editQuery = "";
%>
<%
// *** Delete Record: declare variables

if (String(Request("MM_delete")) == "form1" &&
    String(Request("MM_recordId")) != "undefined") {

  var MM_editConnection = MM_connGp_STRING;
  var MM_editTable = "表1";
  var MM_editColumn = "ID";
  var MM_recordId = "" + Request.Form("MM_recordId") + "";
  var MM_editRedirectUrl = "delete_ok.htm";

  // append the query string to the redirect URL
  if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  }
}
%>
<%
// *** Delete Record: construct a sql delete statement and execute it

if (String(Request("MM_delete")) != "undefined" &&
    String(Request("MM_recordId")) != "undefined") {

  // create the sql delete statement
  MM_editQuery = "delete from " + MM_editTable + " where " + MM_editColumn + " = " + MM_recordId;

  if (!MM_abortEdit) {
    // execute the delete
    var MM_editCmd = Server.CreateObject('ADODB.Command');
    MM_editCmd.ActiveConnection = MM_editConnection;
    MM_editCmd.CommandText = MM_editQuery;
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    if (MM_editRedirectUrl) {
      Response.Redirect(MM_editRedirectUrl);
    }
  }

}
%>
<%
var Recordset1__MMColParam = "1";
if (String(Request.QueryString("ID")) != "undefined" && 
    String(Request.QueryString("ID")) != "") { 
  Recordset1__MMColParam = String(Request.QueryString("ID"));
}
%>
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_connGp_STRING;
Recordset1.Source = "SELECT * FROM 表1 WHERE ID = "+ Recordset1__MMColParam.replace(/'/g, "''") + "";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<html>
<head>
<title>删除记录表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body bgcolor="#FFFFCC">
<div align="center">
  <p><font color="#FF0000" size="5">确认删除记录</font></p>
  <p><font color="#CC0033" size="2">记录一旦删除,将不能恢复。<br>
    请确认你需要删除此记录。</font></p>
  <form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
    <p>你选择的记录的ID号为<%=(Recordset1.Fields.Item("ID").Value)%></p>
    <p>单击“确认”按钮执行删除;单击“取消”链接返回主页。</p>
    <table width="94%" border="1">
      <tr> 
        <td width="19%" height="36"><font size="3">操作日期</font></td>
        <td width="30%"><%=(Recordset1.Fields.Item("日期").Value)%></td>
      </tr>
      <tr> 
        <td><font size="3">股票名称</font></td>
        <td><%=(Recordset1.Fields.Item("股票名").Value)%></td>
      </tr>
      <tr> 
        <td><font size="3">操作类型</font></td>
        <td><%=(Recordset1.Fields.Item("操作").Value)%></td>
      </tr>
      <tr> 
        <td height="36"><font size="3">股数</font></td>
        <td><%=(Recordset1.Fields.Item("股数").Value)%></td>
      </tr>
      <tr> 
        <td><font size="3">单价</font></td>
        <td><%=(Recordset1.Fields.Item("单价").Value)%></td>
      </tr>
      <tr> 
        <td height="22"><font size="3">收入</font></td>
        <td><%=(Recordset1.Fields.Item("收入").Value)%></td>
      </tr>
      <tr> 
        <td><font size="3">卖出时买卖盈亏</font></td>
        <td><%=(Recordset1.Fields.Item("买卖盈亏").Value)%></td>
      </tr>
      <tr> 
        <td><font size="3">备注</font></td>
        <td><%=(Recordset1.Fields.Item("备注").Value)%></td>
      </tr>
    </table>
    <p> 
      <input name="Submit" type="submit" onClick="MM_validateForm('日期','','R','股票名','','R','股数','','RisNum','单价','','NisNum','买卖盈亏','','NisNum','收入','','RisNum');return document.MM_returnValue" value="确认">
      &nbsp; 
      <input type="hidden" name="MM_delete" value="form1">
      <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("ID").Value %>">
    </p>
  </form>
  <p><a href="Admin.asp">取消删除返回数据库管理主页</a></p>
  <p>&nbsp;<a href="../index.asp">取消删除返回站点主页</a></p>
  <p>&nbsp;</p>
</div>
</body>
</html>
<%
Recordset1.Close();
%>

⌨️ 快捷键说明

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