登录 注册  使用Dreamweaver开发ASP/PHP动态网站的优势 学习建议及问题解决的办法 Dreamweaver连接数据库的代码
你的位置:首页 >>> 站内帮助 >>> VIP热点问题 >>> 制作文章系统二级栏目批量修改功能
VIP技术支持中心
欢迎你访问热点问题!我们回答了会员大量的问题,请搜索你想要的 
制作文章系统二级栏目批量修改功能
问题类型 学习教程中的问题 提交时间 2010/12/8 1:07:00
[会员 416*** 提出的问题如下]

陶老师您好,我想请教您一个问题,我在做文章系统二栏目修改的时候,预览无法打开,提示

代码如下:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conn.asp" -->
<%
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")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_conn_STRING
    MM_editCmd.CommandText = "UPDATE dbo.Wz_ylm_biao SET ylm = ?, ypx = ? WHERE yid = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("ylm")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("ypx"), Request.Form("ypx"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "wz_lm.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 Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("yid") <> "") Then
  Recordset1__MMColParam = Request.QueryString("yid")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.Wz_ylm_biao WHERE yid = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim elm__MMColParam
elm__MMColParam =(Recordset1.Fields.Item("yid").Value)
If (Request("MM_EmptyValue") <> "") Then
  elm__MMColParam = Request("MM_EmptyValue")
End If
%>
 <%
Dim elm
Dim elm_cmd
Dim elm_numRows

Set elm_cmd = Server.CreateObject ("ADODB.Command")
elm_cmd.ActiveConnection = MM_conn_STRING
elm_cmd.CommandText = "SELECT * FROM dbo.Wz_elm_biao WHERE ssyl = MMColParam ORDER BY epx ASC"
elm_cmd.Prepared = true

Set elm = elm_cmd.Execute
elm_numRows = 0
%>
 <%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
elm_numRows = elm_numRows + Repeat1__numRows
%>
<!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=gb2312" />
<title>无标题文档</title>
</head>

<body>
<h3>文章管理</h3>
<p><a href="wz.asp">修改删除现有文章</a> <a href="wz_tj.asp">添加新的文章</a> <a href="wz_lm.asp">管理文章栏目</a></p>
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
  <table width="100%" border="0" cellpadding="6" cellspacing="0">
    <tr>
      <td>一级栏目名称</td>
      <td><input name="ylm" type="text" id="ylm" value="<%=(Recordset1.Fields.Item("ylm").Value)%>" size="12" /></td>
      <td>排序</td>
      <td><input name="ypx" type="text" id="ypx" value="<%=(Recordset1.Fields.Item("ypx").Value)%>" size="4" /></td>
    </tr>
    <tr>
      <td>二级栏目名称<br /></td>
      <td colspan="3" id="objFiles" ><% i=1
While ((Repeat1__numRows <> 0) AND (NOT elm.EOF))
%>
          <input name="elm<%=i%>" type="text" id="elm<%=i%>" value="<%=(elm.Fields.Item("elm").Value)%>" size="12" />
          &nbsp; 排序
          <input name="epx<%=i%>" type="text" id="epx<%=i%>" value="<%=(elm.Fields.Item("epx").Value)%>" size="4" />
          <br />
      <% i=i+1
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  elm.MoveNext()
Wend
%></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="3"><input type="submit" name="button" id="button" value="修改" /></td>
    </tr>
  </table>

  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("yid").Value %>" />
</form>
<p>&nbsp;</p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
elm.Close()
Set elm = Nothing
%>

 

[本站回复]
这个页面不能直接预览,需要先进入文章栏目页面,点击修改链接进入
[相关内容]
 在更新记录时提示“操作必须使用一个可更新的查询”
 老师帮看看这个代码什么有错?第42讲 Dreamweaver实现批量更新
 在asp更新用户注册表,当更新ID时出错
 自动更新时间设置
 更新问题??!
 自动更新数据为当前日期
 一个更新记录的统计问题
 更新文章点击数不成功的原因
英超曼城队新闻
 批量更新能不能使用ACCESS的查询视图?

© 2006-2020 陶益|Dreamweaver网页爱好者 版权所有
本站原名:陶益数码 陶益数码工作室 陶益老师自2006年起推出Dreamweaver开发ASP/PHP动态网站视频教程,因可视化开发动态网站深受广大朋友喜爱
本站宗旨:助你使用Dreamweaver轻轻松松地开发自己的ASP/PHP动态网站!让你根据自己的想法开发办公系统! 黔ICP备19009608号