陶益数码工作室-Dreamweaver开发ASP视频教程
你的位置:首页 >>> 站内帮助 >>> VIP热点问题 >>> 老师您好,关于为二栏目添加说明图片的问题
VIP技术支持中心
欢迎你访问热点问题!我们回答了会员大量的问题,请搜索你想要的 
老师您好,关于为二栏目添加说明图片的问题
问题类型 DW实际开发中的问题 提交时间 2011-05-21 14:08:00
[会员 hua*** 提出的问题如下]

老师好:

我在wz_elm的表里加了一个ppic的列,然后又建立一个页面,给二栏目添加说明图片,这个页面的代码是:

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="erro.asp"
MM_grantAccess=false
If Session("ht") <> "" 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
%>
<!--#include file="../Connections/longjf.asp" -->
<!--#include file="../Connections/longjf2.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_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_longjf_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.Wz_elm (ppic) VALUES (?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 203, 1, 1073741823, Request.Form("ppic")) ' adLongVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "wz_rdtj.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 ylm
Dim ylm_cmd
Dim ylm_numRows

Set ylm_cmd = Server.CreateObject ("ADODB.Command")
ylm_cmd.ActiveConnection = MM_longjf_STRING
ylm_cmd.CommandText = "SELECT * FROM dbo.Wz_ylm ORDER BY ypx ASC"
ylm_cmd.Prepared = true

Set ylm = ylm_cmd.Execute
ylm_numRows = 0
%>
<%
Dim elm__MMColParam
elm__MMColParam = "1"
If (Request.QueryString("eid") <> "") Then
  elm__MMColParam = Request.QueryString("eid")
End If
%>
<%
Dim elm
Dim elm_cmd
Dim elm_numRows

Set elm_cmd = Server.CreateObject ("ADODB.Command")
elm_cmd.ActiveConnection = MM_longjf2_STRING
elm_cmd.CommandText = "SELECT * FROM dbo.Wz_elm WHERE eid = ?"
elm_cmd.Prepared = true
elm_cmd.Parameters.Append elm_cmd.CreateParameter("param1", 5, 1, -1, elm__MMColParam) ' adDouble

Set elm = elm_cmd.Execute
elm_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=gb2312" />
<title></title>
</style>
<script>
var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function callServer() {
  var name = document.getElementById("ylm").value;
  if ((name == null) || (name == "")) return;
  var url = "wz_lm_xz.asp?ssyl=" + escape(name);
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null); 
}

function updatePage() {
  if (xmlHttp.readyState < 4) {
 username.innerHTML="正在加载栏目数据......";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
 username.innerHTML=response;
  }
}
</script>
<style type="text/css">
<!--
body,td,th {
 font-size: 12px;
}
-->
</style></head>

<body onload="callServer()">
<h3>热点管理</h3>
<p>添加热点 修改热点</p>
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
  <table width="100%" border="0" cellspacing="0" cellpadding="6">
    <tr>
      <td width="18%">所属版面</td>
      <td width="18%">期刊号
        <select name="ylm" id="ylm" onchange="callServer()">
          <%
While (NOT ylm.EOF)
%>
          <option value="<%=(ylm.Fields.Item("yid").Value)%>"><%=(ylm.Fields.Item("ylm").Value)%></option>
          <%
  ylm.MoveNext()
Wend
If (ylm.CursorType > 0) Then
  ylm.MoveFirst
Else
  ylm.Requery
End If
%>
      </select></td>
      <td width="64%"><div id="username"></div></td>
    </tr>
    <tr>
      <td>热点图片</td>
      <td colspan="2"><input name="ppic" type="hidden" />
      <iframe id="eWebEditor1" src="../eWebEditor/ewebeditor.htm?id=ppic&amp;style=s_np"

frameborder="0" scrolling="No" width="550" height="350"> </iframe></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><input type="submit" name="button" id="button" value="提交" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
<%
ylm.Close()
Set ylm = Nothing
%>
<%
elm.Close()
Set elm = Nothing
%>

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="erro.asp"
MM_grantAccess=false
If Session("ht") <> "" 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
%>
<!--#include file="../Connections/longjf.asp" -->
<!--#include file="../Connections/longjf2.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_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_longjf_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.Wz_elm (ppic) VALUES (?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 203, 1, 1073741823, Request.Form("ppic")) ' adLongVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "wz_rdtj.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 ylm
Dim ylm_cmd
Dim ylm_numRows

Set ylm_cmd = Server.CreateObject ("ADODB.Command")
ylm_cmd.ActiveConnection = MM_longjf_STRING
ylm_cmd.CommandText = "SELECT * FROM dbo.Wz_ylm ORDER BY ypx ASC"
ylm_cmd.Prepared = true

Set ylm = ylm_cmd.Execute
ylm_numRows = 0
%>
<%
Dim elm__MMColParam
elm__MMColParam = "1"
If (Request.QueryString("eid") <> "") Then
  elm__MMColParam = Request.QueryString("eid")
End If
%>
<%
Dim elm
Dim elm_cmd
Dim elm_numRows

Set elm_cmd = Server.CreateObject ("ADODB.Command")
elm_cmd.ActiveConnection = MM_longjf2_STRING
elm_cmd.CommandText = "SELECT * FROM dbo.Wz_elm WHERE eid = ?"
elm_cmd.Prepared = true
elm_cmd.Parameters.Append elm_cmd.CreateParameter("param1", 5, 1, -1, elm__MMColParam) ' adDouble

Set elm = elm_cmd.Execute
elm_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=gb2312" />
<title></title>
</style>
<script>
var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function callServer() {
  var name = document.getElementById("ylm").value;
  if ((name == null) || (name == "")) return;
  var url = "wz_lm_xz.asp?ssyl=" + escape(name);
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null); 
}

function updatePage() {
  if (xmlHttp.readyState < 4) {
 username.innerHTML="正在加载栏目数据......";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
 username.innerHTML=response;
  }
}
</script>
<style type="text/css">
<!--
body,td,th {
 font-size: 12px;
}
-->
</style></head>

<body onload="callServer()">
<h3>热点管理</h3>
<p>添加热点 修改热点</p>
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
  <table width="100%" border="0" cellspacing="0" cellpadding="6">
    <tr>
      <td width="18%">所属版面</td>
      <td width="18%">期刊号
        <select name="ylm" id="ylm" onchange="callServer()">
          <%
While (NOT ylm.EOF)
%>
          <option value="<%=(ylm.Fields.Item("yid").Value)%>"><%=(ylm.Fields.Item("ylm").Value)%></option>
          <%
  ylm.MoveNext()
Wend
If (ylm.CursorType > 0) Then
  ylm.MoveFirst
Else
  ylm.Requery
End If
%>
      </select></td>
      <td width="64%"><div id="username"></div></td>
    </tr>
    <tr>
      <td>热点图片</td>
      <td colspan="2"><input name="ppic" type="hidden" />
      <iframe id="eWebEditor1" src="../eWebEditor/ewebeditor.htm?id=ppic&amp;style=s_np"

frameborder="0" scrolling="No" width="550" height="350"> </iframe></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2"><input type="submit" name="button" id="button" value="提交" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
<%
ylm.Close()
Set ylm = Nothing
%>
<%
elm.Close()
Set elm = Nothing
%>

结果提交到数据库后,添加的图片并没有添加到对应的eid,如下:

请问老师,这个问题该如何解决?

[本站回复]
请参看教程http://www.ty502.com/838.html实现添加栏目时上传图片
[相关内容]
 请匆使用临时文件预览功能
 表格鼠标划过时的颜色怎么设置?
 我想中文网站直接翻译成英文网站,这样翻译器代码有吗
 就像自助建站那样换模板
 如何给图片自动编号
 Dreamweaver里的数据库为灰色
 做框架页面的时候预览不了
 删除前提示是否继续的代码: 放在的位置
 添加后返回原页面
 关于网页适应不同显示率的问题
 像QQ式的简单对话功能可以在网页中实吗?
 网站菜单二、三级栏目的制作
 老师请看这段代码哪里错了。
 数据库多表查询并在同一页面显示结果的问题
 关于多表自动查询的问题
 普通ASP页面右边和底部,加滚动条的问题
 关于教程中的一些问题
 问两个问题【加急】
 iframe与服务器端包括
 制作会员中心密码修改问题
 网站怎样防止恶意发贴?
 制作视频播放页面
 关于复选框的问题?
 如何在网页中直接打开PDF文档?
 有关网页直接打开pdf问题补充说明
 网站计数器代码 
 EXECL数据导入SQL问题
 登录后台不能添加新闻
 登录账号的同时能不能传递参数?
 请教防止网页被盗问题

会员中心 意见建议 获取VIP 联系我们 付款方式 版权声明
陶益数码工作室 Ty502.com Copyright © 2006 版权所有 黔ICP备11000612号