请高手援助,我已在此问题上研究整整20个多小时了!就老是出现添加新记录!我已将rs.addnew 这一行删除
在"rs.open sql,conn,1,3"下面增加一行代码:
if not rs.eof and not rs.bof then 也不行
保存了,也不是缓存的问题!
1.数据库名:#wrtxcnqywz.ldb
表名:Products
2.ProductModify.asp(修改文件)
内容:
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!-- #include file="Inc/Head.asp" -->
<script language="javascript">
function ok()
{
document.form1.tp.value=document.myform.zhuang.value;
}
</script>
<%
dim xid
xid=Trim(Request("ID"))
%>
<!-- #include file="Inc/Head.asp" -->
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from Products where id=" &xid
rs.open sql,conn,1,3
%>
<table width="560" border="0" align="center" cellpadding="2" cellspacing="1" class="table_southidc">
<tr>
<td class="back_southidc" height="25"> <div align="center"><strong>修改文章
<br>
</strong></div></td>
</tr>
<tr>
<form name="myform" method="post" action="ProductSave.asp?ID=xid" OnSubmit="return checkkk()" >
<td valign="bottom">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr >
<td width="20%" align="right" class="tr_southidc"><div align="center" class="td_southidc">图片上传: </div></td>
<td width="80%" class="tr_southidc"> <input name="zhuang" type="text" id="zhuang" value="<%=rs("DefaultPicUrl")%>" size="30">
<input type="button" name="Submit2" value="上传图片" onClick="window.open('upfile.asp?formname=myform&editname=zhuang&uppath=UploadFiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> </td>
</tr>
</table></td>
</form>
</tr>
<tr>
<form name="form1" method="post" action="ProductAdd.asp?mark=southidc">
…………
</form>
</tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
rs.Close
set rs=Nothing
call CloseConn()
%>
3.ProductSave.asp(保存文件)
内容:
<!--#include file="conn.asp"-->
<%
dim newid,content,bg,sg,bh,mc,gg,dw,bz,tm,pass,pic,tp
newid=Trim(Request("ID"))
content=Trim(Request("content"))
bg=Trim(Request("bg"))
sg=Trim(Request("sg"))
bh=Trim(Request("bh"))
mc=Trim(Request("mc"))
gg=Trim(Request("gg"))
dw=Trim(Request("dw"))
bz=Trim(Request("bz"))
tm=Trim(Request("time"))
pass=Trim(Request("pass"))
pic=Trim(Request("pic"))
tp=Trim(Request("tp"))
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Products where id=" & newid
rs.open sql,conn,1,3
rs("time") =Date()
rs("content")=content
rs("BigClassName")=bg
rs("SmallClassName")=sg
rs("Product_Id")=bh
rs("Title")=mc
rs("Spec")=gg
rs("Unit")=dw
rs("Memo")=bz
rs("UpdateTime")=tm
rs("Passed")=pass
rs("IncludePic")=pic
rs("DefaultPicUrl")=tp
rs.update
rs.close
%>
[此贴子已经被阳光白雪于2007-4-27 9:25:44编辑过]