asp form提交 批量修改记录 无法循环

来源:百度知道 编辑:UC知道 时间:2024/07/07 02:50:45
想要一次修改一列记录,然而每次只修改第一条记录,没有循环 望高手指点!出错的应该在程序最后面的 For i=LBound(ID) To UBound(ID)

<!--#include file="top.asp"-->

<%call main()%>
<%sub main()%>
<%
if Request("action") = "edit" then
call edit()
else
call dudao()
end if
%>
<%end sub%>

<%sub dudao()%>
<table width="980" align="center" bgcolor="#F1F3F5">
<tr>
<td>
<tr vlign="top">

<%s=trim(Request.Form("xueqi"))%>
<td height="33" align="center" bgcolor="#F1F3F5"><span style="font-size: 16pt; font-weight: bold;">
成员名单</span></td>
</tr>
<tr>
<td>

<%
set rs2 = server.createobject("adodb.recordset")
sql = "select * from dudao order by id

<form name="form" method="post" action="dudao.asp?action=edit&ID=<%=rs2("ID")%>" onsubmit="return check(this)">
这样写只能提交一个id,所以只能修改一条记录
改成
<form name="form" method="post" action="dudao.asp?action=edit" onsubmit="return check(this)"> 并且要放在循环之前,也就是
<%
j=rs2.eof
for i=1 to rs2.recordcount
if rs2.eof then
exit for
end if
%> 这段代码的前面
然后在循环里放一个隐藏域保存id

<input name="id" type="hidden" id="id" value="<%=rs2("ID")%>">

如下:
'...............这里就不写了
<%else%>

<form name="form" method="post" action="dudao.asp?action=edit" onsubmit="return check(this)">

<%
j=rs2.eof
for i=1 to rs2.recordcount
if rs2.eof then
exit for
end if