我真的需要一些关于这段代码的帮助。该循环仅在可能选择 4 条记录时才使更新语句运行一次,因此它必须循环 4 次。这是我第一次遇到这个问题,我似乎不明白为什么会这样。请帮忙。谢谢你。
<!--#include file="connectionString.inc"-->
<%
Dim strmode, arrmode,i,rs,SQLstr, a, b, site_to
strmode=Request.form("changeBox")
cont1=request.form("cont1")
arrmode=split(strmode,",")
if request.form("submitChange") = "" then
response.write("Please try again, you have no selected anything. Press back on your browser")
end if
if request.form("submitChange") = "site" then
response.write(b)
for i = 0 to UBound(arrmode)
SQLstr = "UPDATE SCSer SET Ser_Site_Num = '" & request.form("site_to") & "' WHERE Ser_Num = '" & arrmode(i) & "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open SQLstr, conn, 1, 2
Response.Write("SUCCESSFULLY UPDATED! " + arrmode(i))
next
end if
if request.form("submitChange") = "contract" then
a=LBound(arrmode)
b=UBound(arrmode)
SQLstr = "UPDATE SCSer SET Ser_Site_Num = '" & request.form("site_to") & "' WHERE Ser_Num BETWEEN '" & arrmode(a) & "' AND '" & arrmode(b) & "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open SQLstr, conn, 1, 2
Response.Write("SUCCESSFULLY UPDATED! <br/>")
response.write(arrmode(a)+"<br/>")
response.write(arrmode(b))
end if
%>