首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

ASP怎么结束本次for循环继续上次循环

2012-08-28 
ASP如何结束本次for循环继续下次循环VB codeArrStudentIDsplit(request(StudentID),,)分离出学生学

ASP如何结束本次for循环继续下次循环

VB code
ArrStudentID=split(request("StudentID"),",")    '分离出学生学号       for   i=0   to   ubound(ArrStudentID)-1           score1=request("Score1"   &   ArrStudentID(i))      score2=request("Score2"   &   ArrStudentID(i))            score3=request("Score3"   &   ArrStudentID(i))            score4=request("Score4"   &   ArrStudentID(i))      score5=request("Score5"   &   ArrStudentID(i))      score6=request("Score6"   &   ArrStudentID(i))      score7=request("Score7"   &   ArrStudentID(i))          '得到对应学生的输入成绩if  score1="" and score2="" and score3="" and score4="" and score5="" and score6="" and score7="" then  goto   nextforend ifsql = "update 成绩 set " if trim(score1) <> "" then sql = sql & " 实验一="&score1if trim(score2) <> "" then sql = sql & " ,实验二="&score2  if trim(score3) <> "" then sql = sql & " ,实验三="&score3if trim(score4) <> "" then sql = sql & " ,实验四="&score4if trim(score5) <> "" then sql = sql & " ,实验五="&score5if trim(score6) <> "" then sql = sql & " ,实验六="&score6 if trim(score7) <> "" then sql = sql & " ,考试="&score7 sql = sql & " where 课程名='"&session("id1")&"' and 学号='"&ArrStudentID(i)&"'"response.write(sql)conn.execute(sql)nextfor:next      %>

提示缺少语句,也不知道错哪里,应该怎么改,只要实现相同功能就行:score1-score7都为空时不执行Update语句,不都为空值时就执行Update!!!!

[解决办法]
ArrStudentID=split(request("StudentID"),",")
'分离出学生学号
for i=0 to ubound(ArrStudentID)-1

score1=request("Score1" & ArrStudentID(i))
score2=request("Score2" & ArrStudentID(i))
score3=request("Score3" & ArrStudentID(i))
score4=request("Score4" & ArrStudentID(i))
score5=request("Score5" & ArrStudentID(i))
score6=request("Score6" & ArrStudentID(i))
score7=request("Score7" & ArrStudentID(i))
if Not CBool(score1="" and score2="" and score3="" and score4="" and score5="" and score6="" and score7="") then
sql = "update 成绩 set " 
if trim(score1) <> "" then sql = sql & " 实验一="&score1
if trim(score2) <> "" then sql = sql & " ,实验二="&score2
if trim(score3) <> "" then sql = sql & " ,实验三="&score3
if trim(score4) <> "" then sql = sql & " ,实验四="&score4
if trim(score5) <> "" then sql = sql & " ,实验五="&score5
if trim(score6) <> "" then sql = sql & " ,实验六="&score6 
if trim(score7) <> "" then sql = sql & " ,考试="&score7 
sql = sql & " where 课程名='"&session("id1")&"' and 学号='"&ArrStudentID(i)&"'"
response.write(sql)
conn.execute(sql)
end if
next

热点排行
Bad Request.