| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 485 人关注过本帖
标题:ASP提交表单时,数据修改了没有保存。请高手指点!
只看楼主 加入收藏
vcfriend
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-3-12
收藏
 问题点数:0 回复次数:0 
ASP提交表单时,数据修改了没有保存。请高手指点!

这是源程序。是一个在线编辑系统。就是内容在修改后。发现Content值并没有改变。不知原因在哪里。请高手指点

<%@language=vbscript codepage=936 %>
<!--#include file="Admin.asp"-->
<!--#include file="conn.asp"-->

<%
response.buffer=true
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
dim ArticleID,rsArticle,FoundErr,ErrMsg
ArticleID=trim(request("ArticleID"))
FoundErr=False
if ArticleID="" then
response.Redirect("ArticleManage.asp")
end if
sql="select * from Product where ArticleID=" & ArticleID & ""
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sql,conn,1,1
if FoundErr=True then
call WriteErrMsg()
else
%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;

function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}

function CheckForm()
{
if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML;

if (document.myform.Title.value=="")
{
alert("文章标题不能为空!");
document.myform.Title.focus();
return false;
}
if (document.myform.Key.value=="")
{
alert("关键字不能为空!");
document.myform.Key.focus();
return false;
}
if (document.myform.Content.value=="")
{
alert("文章内容不能为空!");
editor.HtmlEdit.focus();
return false;
}
if (document.myform.Content.value.length>6400000)
{
alert("信息内容太长,超过了6.4M!建议将信息分成几部分录入,否则可能影响存储信息和读取信息的速度!如果您执意的话,请继续!");
editor.HtmlEdit.focus();
return false;
}

return true;
}
function loadForm()
{
editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
return true
}
</script>
<!-- #include file="Inc/Head.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="150" align="center" valign="top"> <table width="150" height="100%" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle">
<tr>
<td align="center" valign="top"><table width="100%" height="24" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">功能菜单</td>
</tr>
</table>
<table width="100%" height="90%" border="0" cellpadding="0" cellspacing="0" class="MenuBg">
<tr>
<td align="center" valign="top"><br> <table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="16%"><img src="../image/Left_1.gif" width="28" height="11"></td>
<td width="84%" height="20"><font color="#FFFF00">产品管理</font></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="34%" height="20" align="right"><img src="../image/Left_1_1.gif" width="29" height="16"></td>
<td width="66%" valign="bottom"><a href="ClassManage.asp"><font color="#FFFF00">产品类别设置</font></a></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="34%" height="20" align="right"><img src="../image/Left_1_1.gif" width="29" height="16"></td>
<td width="66%" valign="bottom"><a href="ArticleManage.asp"><font color="#FFFF00">产品管理</font></a></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="34%" height="20" align="right"><img src="../image/Left_1_1.gif" width="29" height="16"></td>
<td width="66%" valign="bottom"><a href="ArticleAdd.asp"><font color="#FFFF00">添加产品</font></a></td>
</tr>
</table>
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="34%" height="20" align="right"><img src="../image/Left_1_1.gif" width="29" height="16"></td>
<td width="66%" valign="bottom"><a href="ArticleCheck.asp"><font color="#FFFF00">审核产品</font></a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="862" align="center" valign="top">
<br>
<br>
<b> </b><b>修 改 产 品</b><br>
<br>
<form action="Manage_Product_Save.asp?action=Modify" method="POST" name="myform" id="myform" onSubmit="return CheckForm();" onReset="return ResetForm();">
<table width="620" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td height="25" align="center" class="title">&nbsp;</td>
</tr>
<tr align="center">
<td class="tdbg">
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="152" height="22" align="right" bgcolor="#C0C0C0">所属栏目:</td>
<td width="462" bgcolor="#E3E3E3">
<%
if session("purview")=3 or session("purview")=4 then
response.write rsArticle("BigClassName") & "<input name='BigClassName' type='hidden' value='" & rsArticle("BigClassName") & "'>&gt;&gt;"
else
sql = "select * from BigClass"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
else
%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<%
do while not rs.eof
%>
<option <% if rs("BigClassName")=rsArticle("BigClassName") then response.Write("selected") end if%> value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<%
end if
if session("purview")=4 then
response.write rsArticle("SmallClassName") & "<input name='SmallClassName' type='hidden' value='" & rsArticle("SmallClassName") & "'>"
else
%>
<select name="SmallClassName">
<option value="" <%if rsArticle("SmallClassName")="" then response.write "selected"%>>不指定小类</option>
<%
sql="select * from SmallClass where BigClassName='" & rsArticle("BigClassName") & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
do while not rs.eof%>
<option <% if rs("SmallClassName")=rsArticle("SmallClassName") then response.Write("selected") end if%> value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<%
end if
%>
</td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">产品编号:</td>
<td bgcolor="#E3E3E3">
<input name="Product_Id" type="text"
id="Product_Id" value="<%=rsArticle("Product_Id")%>" size="9" maxlength="9">
<font color="#FF0000">*</font> </td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">产品名称:</td>
<td bgcolor="#E3E3E3">
<input name="Title" type="text"
id="Title" value="<%=rsArticle("Title")%>" size="50" maxlength="80">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">关键字:</td>
<td bgcolor="#E3E3E3">
<input name="Key" type="text"
id="Key" value="<%=trim(rsArticle("Key"))%>" size="50" maxlength="255">
<font color="#FF0000">*</font><br>
用来查找相关文章,可输入多个关键字,中间用空格分开。不能出现&quot;'*?()等字符。</td>
</tr>
<tr>
<td height="22" align="right" valign="middle" bgcolor="#C0C0C0">产品说明:</td>
<td bgcolor="#E3E3E3"><%=ArticleID%> </td>
</tr>
<tr align="left" bgcolor="#E3E3E3">
<td colspan="2" valign="middle">
<textarea name="Content" style="display:none"><%=rsArticle("Content")%></textarea>
<iframe ID="editor" src="Editor_Main.asp?Action=Modify&ActionFrome=Product&ArticleID=<%=ArticleID%>" frameborder=1 scrolling=no width="680" height="382"></iframe>
</td>
</tr>
<tr>
<td width="90" align="right" bgcolor="#C0C0C0">首页图片:
<input name="IncludePic" type="hidden" id="IncludePic" value="yes"></td>
<td colspan="3" bgcolor="#E3E3E3">
<input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="<%=rsArticle("DefaultPicUrl")%>" size="50" maxlength="200">
<br>
首页的图片,直接从上传图片中选择:
<select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
<option value=""<% if rsArticle("DefaultPicUrl")="" then response.write "selected" %>>不指定首页图片</option>
<%
if rsArticle("UploadFiles")<>"" then
dim IsOtherUrl
IsOtherUrl=True
if instr(rsArticle("UploadFiles"),"|")>1 then
dim arrUploadFiles,intTemp
arrUploadFiles=split(rsArticle("UploadFiles"),"|")
for intTemp=0 to ubound(arrUploadFiles)
if rsArticle("DefaultPicUrl")=arrUploadFiles(intTemp) then
response.write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
IsOtherUrl=False
else
response.write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
end if
next
else
if rsArticle("UploadFiles")=rsArticle("DefaultPicUrl") then
response.write "<option value='" & rsArticle("UploadFiles") & "' selected>" & rsArticle("UploadFiles") & "</option>"
IsOtherUrl=False
else
response.write "<option value='" & rsArticle("UploadFiles") & "'>" & rsArticle("UploadFiles") & "</option>"
end if
end If
if IsOtherUrl=True then
response.write "<option value='" & rsArticle("DefaultPicUrl") & "' selected>" & rsArticle("DefaultPicUrl") & "</option>"
end if
end if
%>
</select>
<input name="UploadFiles" type="hidden" id="UploadFiles" value="<%=rsArticle("UploadFiles")%>">
</td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">已通过审核:</td>
<td bgcolor="#E3E3E3">
<input name="Passed" type="checkbox" id="Passed" value="yes" <% if rsArticle("Passed")=true then response.Write("checked") end if%>>
是<font color="#0000FF">(如果选中的话将直接发布)</font></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">首页显示:</td>
<td bgcolor="#E3E3E3">
<input name="Elite" type="checkbox" id="Elite" value="yes" <% if rsArticle("Elite")=true then response.Write("checked") end if%>>
是<font color="#0000FF">(如果选中的话将在首页做为新产品显示)</font></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">录入时间:</td>
<td bgcolor="#E3E3E3">
<input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50">
当前时间为:<%=now()%> 注意不要改变格式。</td>
</tr>
</table>
</td>
</tr>
</table>
<div align="center">
<p>
<input name="ArticleID" type="hidden" id="ArticleID" value="<%=rsArticle("ArticleID")%>">
<input name="Content" type="hidden" id="Content" value="<%=Content%>">
<input name="Save" type="submit" id="Save" value="保存修改结果">
&nbsp;
<input type="reset" value=" 重 写 "name="cmdcancel">
</p>
</div>
</form>
</td>
</tr>
</table>


<!-- #include file="Inc/Foot.asp" -->
<%
end if
rsArticle.close
set rsArticle=nothing
call CloseConn()
%>


<%
function ContentEncode(fString)
fString=Replace(fString,vbCrlf, "")
fString=Replace(fString,"\","&#92;")
fString=Replace(fString,"'","&#39;")
fString=Replace(fString,"<A href=","<A target=_blank href=") '点链接打开新窗口
if SiteSettings("BannedHtmlLabel")<>"" then fString=ReplaceText(fString,"<(\/|)("&SiteSettings("BannedHtmlLabel")&")", "&lt;$1$2")
if SiteSettings("BannedHtmlEvent")<>"" then fString=ReplaceText(fString,"<(.[^>]*)("&SiteSettings("BannedHtmlEvent")&")", "&lt;$1$2")
if SiteSettings("BannedText")<>"" then
filtrate=split(SiteSettings("BannedText"),"|")
for i = 0 to ubound(filtrate)
fString=ReplaceText(fString,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
next
end if
contentEncode=fString
end function

%>


搜索更多相关主题的帖子: 表单 ASP 数据 
2007-03-12 11:34
快速回复:ASP提交表单时,数据修改了没有保存。请高手指点!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020156 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved