日期:2014-05-17  浏览次数:20892 次

急!修改ASP文章内容时,当提交的时候,却变成了添加一条记录!请大家指教
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->

<%
title=server.htmlencode(Trim(Request("id")))
Content=Trim(Request("Content"))
BigClassName=request("BigClassName")
client=request("client")
prosize=request("prosize")
prodic=request("prodic")
compyear=request("compyear")
SmallClassName=request("SmallClassName")
%>
<%if Request.QueryString("mark")="southidc" then%>
<%
If Content="" Then
response.write "SORRY <br>"
response.write "内容不能为空!!<a href=""javascript:history.go(-1)"">返回重输</a>"
response.end
end if

Set rs = Server.CreateObject("ADODB.Recordset")
if title="" then
sql="select * from Procase"
else
sql="select * from Procase where id="&title
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
response.Write(title)
if title="" then
rs.addnew
else
end if
rs("SmallClassName")=SmallClassName
rs("BigClassName")=BigClassName
rs("title")=request.Form("arttitle")
rs("Content")=Content
rs("client")=client
rs("prosize")=prosize
rs("compyear")=compyear
rs("prodic")=prodic
rs("firstImageName")= trim(Request.form("img"))
rs.update
rs.close
response.redirect "News_Manage.asp"
end if
%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass_New 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.Content.value=="")
  {
  alert("内容不能为空!");
editor.HtmlEdit.focus();
return false;
  }
  return true;  
}
</script>
<%
mainContent=""
Set rs1 = Server.CreateObject("ADODB.Recordset")
sql1="select * from Procase where id="&title