批量修改的问题,急
代码如下:
<%if request( "type ")= "edit " then %>
<%set rs=server.createobject( "adodb.recordset ")
sql= "select * from class order by classid "
rs.open sql,conn,1,1
%>
<form action=admin_pro_class.asp?type=save method=post>
<div align= "center ">
<table width= "100% " border= "0 " cellpadding= "2 " cellspacing= "1 " bgcolor= "#FFFFFF " class= "border ">
<tr class= "topbg " onMouseOut= "this.style.backgroundColor= ' ' " onMouseOver= "this.style.backgroundColor= '#F6FcF9 ' ">
<td height=20 align= "center " colspan= "2 "> 产品类型管理 </td>
</tr>
<% while not rs.eof %>
<tr class= "tdbg " onMouseOut= "this.style.backgroundColor= ' ' " onMouseOver= "this.style.backgroundColor= '#F6FcF9 ' ">
<td height=23 width= "27% " align= "right "> <%=rs( "classid ")%> </td>
<td height=23 width= "71% "> <input type=text name= <%= "text " & rs( "classid ") %> size= "35 " maxlength=100 value= <%=rs( "classname ")%> > </td>
</tr>
<% rs.movenext
wend
%>
<tr class= "tdbg " onMouseOut= "this.style.backgroundColor= ' ' " onMouseOver= "this.style.backgroundColor= '#F6FcF9 ' ">
<td height=20 colspan= "2 " align= "center ">
<input type=submit value=提交 >
<input type=reset value=取消 onclick=javascript:history.go(-1)> </td>
</tr>
</table> </div> </form> <% end if %>
<%call copyright%>
</body>
</html>
<%if request( "type ")= "save " then %>
<% dim i
Set rs=Server.CreateObject( "Adodb.RecordSet ")
sql= "select * from class order by classid "
rs.open sql,conn,1,3
i=0
for each k in request.form
if instr(1,k, "text ") <> 0 then
classname=request.form(k)
if rs( "classname ") <> classname then
response.Write classname
sql= "update class set classname= ' "& classname & " 'where classid= "&rs( "classid ")
Conn.execute sql,,adcmdtext
i=i+1
end if
rs.movenext
end if
next
rs.close
response.write " <script> alert( '资料更改成功 ');l