我参照5楼朋友的方法改了一下,加了一个隐藏的对象来传递id号实现了此功能,谢谢大家的帮忙。
但是提交表单时要验证每条记录的文本框是否填了值时不起作用,麻烦大家再帮我看一下,谢谢!!!
<%sub saveform()%>
<%if request("zbdw")="" then%>
<script language=javascript>
alert( "错误:请选择制表单位!" );
location.href = "javascript:history.back()"
</script>
<%elseif Request.form("jsfsh")="" then%>
<script language=javascript>
alert( "
错误:请选择结算方式!" );
location.href = "javascript:history.back()"
</script>
<%elseif Request.form("thj")="" then%>
<script language=javascript>
alert( "
错误:请输入提货价!" );
location.href = "javascript:history.back()"
</script>
<%else%>
<%
if request.form("jsfsh").count<>0 then
for i=1 to request.form("jsfsh").count
sql0="delete from jiage where shx='1'"
conn.execute(sql0)
id=request("id"&i)
qsrq=trim(Request.Form("qsyear"))&"-"&trim(Request.Form("qsmonth"))&"-"&trim(Request.Form("qsday"))
jsrq=trim(Request.Form("jsyear"))&"-"&trim(Request.Form("jsmonth"))&"-"&trim(Request.Form("jsday"))
set rs=server.CreateObject("adodb.recordset")
sql = "select * from jiage where kc_id="+id
rs.Open sql,conn,1,3
rs("chd") = Request.form("jsfsh")(i)
rs("jhj") = Request.form("thj")(i)
rs("qrj") = Request.form("thj")(i)
rs("zbdw") = request("zbdw")
rs("bzh") = request("bzh")(i)
rs("qsrq") = qsrq
rs("jsrq") = jsrq
rs("addtime") = now()
rs("shx") ="1"
rs.Update
rs.Close
set rs=nothing
next
end if
response.write "<p>"
response.write "<div align=center><br><br><br><font color=red>信息添加成功</font><p><a href=kucun.asp>返回</a></div>"
%>
<%end if%>