ASP中数组循环提交到数据库的问题
我这段代码中,如果任意一组数组里的字段只有s14s15s16s17s18s19s10s11的情况下就不能更新到数据库,如果是s14s15s16s17s18s19s10s1...
我这段代码中,如果任意一组数组里的字段只有s14 s15 s16 s17 s18 s19 s10 s11的情况下就不能更新到数据库, 如果是s14 s15 s16 s17 s18 s19 s10 s11 s24 s25 s26 s27 s28 .....的话就可以更新到数据库,这是什么原因for i=1 to request.form("actionid").count
if request.form("shopcount")(i)<=0 then
shopcount=1
ss16=1
else
shopcount=Int(request.form("s14")(i))+Int(request.form("s15")(i))+Int(request.form("s16")(i))+Int(request.form("s17")(i))+Int(request.form("s18")(i))+Int(request.form("s19")(i))+Int(request.form("s10")(i))+Int(request.form("s11")(i)) + Int(request.form("s24")(i))+Int(request.form("s25")(i))+Int(request.form("s26")(i))+Int(request.form("s27")(i))+Int(request.form("s28")(i))+Int(request.form("s29")(i))+Int(request.form("s20")(i))+Int(request.form("s21")(i))+Int(request.form("s34")(i))+Int(request.form("s35")(i))+Int(request.form("s36")(i))+Int(request.form("s37")(i))+Int(request.form("s38")(i))+Int(request.form("s39")(i))+Int(request.form("s30")(i))+Int(request.form("s31")(i))+Int(request.form("s44")(i))+Int(request.form("s45")(i))+Int(request.form("s46")(i))+Int(request.form("s47")(i))+Int(request.form("s48")(i))+Int(request.form("s49")(i))+Int(request.form("s40")(i))+Int(request.form("s41")(i))
ss14=Int(request.form("s14")(i))
ss15=Int(request.form("s15")(i))
'这里面都一样的方法,百度说我的文字过长所以我去掉这块内容了
ss48=Int(request.form("s48")(i))
ss49=Int(request.form("s49")(i))
ss40=Int(request.form("s40")(i))
ss41=Int(request.form("s41")(i))
end if
'shopcount=shopcount+ss16
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_snsn where shopid="&request.form("shopid")(i),conn,1,1
if request.cookies("snsn")("username")="" then
zonger2=rs_s("shichangjia")*shopcount
else
if request.Cookies("snsn")("reglx")=1 then
zonger2=rs_s("huiyuanjia")*shopcount
else
zonger2=rs_s("vipjia")*shopcount
end if
end if
kucun=rs_s("kucun")
shopname=rs_s("shopname")
rs_s.close
set rs_s=nothing
if kucun<Int(shopcount) then
response.write "<script language=javascript>alert('你选购的商品“"&shopname&"”库存不足,不能修改数量,请选购更换其它商品!');window.location.href='gouwu.asp?action=show';</script>"
response.end
end if
conn.execute("update shop_action set s14="&ss14&",s15="&ss15&",s16="&ss16&",s17="&ss17&",s18="&ss18&",s19="&ss19&",s10="&ss10&",s11="&ss11&",s24="&ss24&",s26="&ss26&",s25="&ss25&",s27="&ss27&",s28="&ss28&",s29="&ss29&",s20="&ss20&",s21="&ss21&",s34="&ss34&",s35="&ss35&",s36="&ss36&",s37="&ss37&",s38="&ss38&",s39="&ss39&",s30="&ss30&",s31="&ss31&",s44="&ss44&",s45="&ss45&",s46="&ss46&",s47="&ss47&",s48="&ss48&",s49="&ss49&",s40="&ss40&",s41="&ss41&",shopcount="&shopcount&",zonger="&zonger2&" where actionid="&request.form("actionid")(i))
next
response.Redirect "gouwu.asp?action=show"
%> 展开
if request.form("shopcount")(i)<=0 then
shopcount=1
ss16=1
else
shopcount=Int(request.form("s14")(i))+Int(request.form("s15")(i))+Int(request.form("s16")(i))+Int(request.form("s17")(i))+Int(request.form("s18")(i))+Int(request.form("s19")(i))+Int(request.form("s10")(i))+Int(request.form("s11")(i)) + Int(request.form("s24")(i))+Int(request.form("s25")(i))+Int(request.form("s26")(i))+Int(request.form("s27")(i))+Int(request.form("s28")(i))+Int(request.form("s29")(i))+Int(request.form("s20")(i))+Int(request.form("s21")(i))+Int(request.form("s34")(i))+Int(request.form("s35")(i))+Int(request.form("s36")(i))+Int(request.form("s37")(i))+Int(request.form("s38")(i))+Int(request.form("s39")(i))+Int(request.form("s30")(i))+Int(request.form("s31")(i))+Int(request.form("s44")(i))+Int(request.form("s45")(i))+Int(request.form("s46")(i))+Int(request.form("s47")(i))+Int(request.form("s48")(i))+Int(request.form("s49")(i))+Int(request.form("s40")(i))+Int(request.form("s41")(i))
ss14=Int(request.form("s14")(i))
ss15=Int(request.form("s15")(i))
'这里面都一样的方法,百度说我的文字过长所以我去掉这块内容了
ss48=Int(request.form("s48")(i))
ss49=Int(request.form("s49")(i))
ss40=Int(request.form("s40")(i))
ss41=Int(request.form("s41")(i))
end if
'shopcount=shopcount+ss16
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_snsn where shopid="&request.form("shopid")(i),conn,1,1
if request.cookies("snsn")("username")="" then
zonger2=rs_s("shichangjia")*shopcount
else
if request.Cookies("snsn")("reglx")=1 then
zonger2=rs_s("huiyuanjia")*shopcount
else
zonger2=rs_s("vipjia")*shopcount
end if
end if
kucun=rs_s("kucun")
shopname=rs_s("shopname")
rs_s.close
set rs_s=nothing
if kucun<Int(shopcount) then
response.write "<script language=javascript>alert('你选购的商品“"&shopname&"”库存不足,不能修改数量,请选购更换其它商品!');window.location.href='gouwu.asp?action=show';</script>"
response.end
end if
conn.execute("update shop_action set s14="&ss14&",s15="&ss15&",s16="&ss16&",s17="&ss17&",s18="&ss18&",s19="&ss19&",s10="&ss10&",s11="&ss11&",s24="&ss24&",s26="&ss26&",s25="&ss25&",s27="&ss27&",s28="&ss28&",s29="&ss29&",s20="&ss20&",s21="&ss21&",s34="&ss34&",s35="&ss35&",s36="&ss36&",s37="&ss37&",s38="&ss38&",s39="&ss39&",s30="&ss30&",s31="&ss31&",s44="&ss44&",s45="&ss45&",s46="&ss46&",s47="&ss47&",s48="&ss48&",s49="&ss49&",s40="&ss40&",s41="&ss41&",shopcount="&shopcount&",zonger="&zonger2&" where actionid="&request.form("actionid")(i))
next
response.Redirect "gouwu.asp?action=show"
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询