I really need some help with this code. The loop is only making the update statement run once when there are maybe 4 records chosen so it has to loop 4 times. This is the 1st time ive come across this problem and I cant seem to see why it is doing it like that. Please help. Thank you.
<!--#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
%>
Try this and see what the response says: