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

📄 admin_class_edit.asp

📁 演示中使用的数据库为省、市、县三级数据库 演示程序实现了省、市、县三级联动(ajax技术) 程序调用方法: 1:把 <script language="javascript" src="
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!--#include file="admin_check.asp" -->
<!--#include file="conn_acc.asp" -->
<!--#include file="function.asp" --><%
dim f_cid,ffid
f_cid =Request.Form("f_cid")
ffid =Request.Form("ffid")
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
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "form_menu") Then
if f_cid = Request.Form("MM_recordId") then
Response.Redirect "error.asp?error="&server.URLEncode("父级别不能和子级别相同!")
response.end()
end if
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_conn_comm_STRING
	
	
    MM_editCmd.CommandText = "UPDATE firste_city SET f_title = ?, f_p = ?, f_up = ? WHERE fid = ?" 
	
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("f_title")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("f_p"), Request.Form("f_p"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(f_cid, f_cid, null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
	if f_cid <> ffid then
	Set Command1 = Server.CreateObject ("ADODB.Command")
Command1.ActiveConnection = MM_conn_comm_STRING
Command1.CommandText = "UPDATE firste_city  SET f_grade =f_grade+1  WHERE fid = "&f_cid
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

    if cint(ffid)<>0 then
	Set Command2 = Server.CreateObject ("ADODB.Command")
Command2.ActiveConnection = MM_conn_comm_STRING
Command2.CommandText = "UPDATE firste_city  SET f_grade =f_grade-1  WHERE fid = "&ffid
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()
	end if
	end if
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = Request.QueryString("url")
    '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 rs__MMColParam
rs__MMColParam = "1"
If (Request.QueryString("eid") <> "") Then 
  rs__MMColParam = Request.QueryString("eid")
End If
%>
<%
Dim rs
Dim rs_cmd
Dim rs_numRows

Set rs_cmd = Server.CreateObject ("ADODB.Command")
rs_cmd.ActiveConnection = MM_conn_comm_STRING
rs_cmd.CommandText = "SELECT * FROM firste_city WHERE fid = ?" 
rs_cmd.Prepared = true
rs_cmd.Parameters.Append rs_cmd.CreateParameter("param1", 5, 1, -1, rs__MMColParam) ' adDouble

Set rs = rs_cmd.Execute
rs_numRows = 0
%>




<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>firste</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="t3">
  <tr>
    <td class="l"></td>
    <td align="center" class="t">修改导航</td>
    <td class="r"></td>
  </tr>
</table>
<div class="b3">
 <table width="99%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><form action="<%=MM_editAction%>" method="POST" name="form_menu" id="form_menu">
      <table width="96%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#D6EFF7">
        <tr>
          <td width="39%" align="right" bgcolor="#FFFFFF"><strong>导航名称:</strong></td>
          <td width="61%" bgcolor="#FFFFFF"><input name="f_title" type="text" id="f_title" value="<%=(rs.Fields.Item("f_title").Value)%>" maxlength="10"></td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF"><strong>父类别:</strong></td>
          <td bgcolor="#FFFFFF"><% call firste_classselect(MM_conn_comm_STRING,"firste_city",0,0,(rs.Fields.Item("f_up").Value)) %><br>
<span class="fred">顶级类别不选</span></td>
        </tr>
        
        <tr>
          <td align="right" bgcolor="#FFFFFF"><strong>排序:</strong></td>
          <td bgcolor="#FFFFFF"><input name="f_p" type="text" id="f_p" value="<%=(rs.Fields.Item("f_p").Value)%>" size="4" maxlength="4" onKeyUp="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
          <br>
<span class="fred">数字越大越靠后</span></td>
        </tr>
        <tr>
          <td colspan="2" align="center" bgcolor="#FFFFFF">
          <input type="hidden" name="ffid" id="ffid" value="<%= (rs.Fields.Item("f_up").Value) %>">
          <input type="submit" name="button" id="button" value=" 修  改 ">
            <input type="button" name="button" id="button" value=" 取 消 " onClick="javascript:history.go(-1);"></td>
          </tr>
      </table>
        
      <input type="hidden" name="MM_insert" value="form_menu">
      <input type="hidden" name="MM_update" value="form_menu">
      <input type="hidden" name="MM_recordId" value="<%= rs.Fields.Item("fid").Value %>">
    </form>
    </td>
  </tr>
</table>


</div> 
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="t3b">
  <tr>
    <td class="l">&nbsp;</td>
    <td class="c">&nbsp;</td>
    <td class="r">&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
</table>
</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>

⌨️ 快捷键说明

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