我收到错误“Loop without do”。
我无法弄清楚为什么我的所有if
语句都以end if
结束。
也许你们可以帮我检查一下它没有关闭的地方(如果它没有关闭)
这是我的代码
Do until Int(uitgevoerd)=Int(aantal_cat)
Do until Not IsEmpty(request.form("categorie" & i))
i=i+1
loop
Select Case True
cbvcode = request.form("cbvcode" & i)
' Case Instr(cbvcode, "cbvcode") > 0
if Instr(cbvcode, "cbvcode") > 0 then
'objConProjecten.Execute(finanSQL)
uitgevoerd=uitgevoerd+1
i=i+1
else
bedragdeelnemer = request.form("bedragdeelnemer"& i)
cat_id = request.form("categorie" & i)
huidig_cat_id = request.form("huidig_cat_id_" & i)
volgnummer = request.form("volgnummer" & i)
'cbvcode = request.form("cbvcode" & i)
'kijk of bedragdeelnemer leeg is. Zoniet doe een update of een insert.
if bedragdeelnemer = "" then
bedragdeelnemer = 0
end if
FOR c=1 to 5
if Int(categorieen(c))=Int(cat_id) then
catgebruikt = TRUE
categorieen(c)=null
end if
NEXT
response.write("<br>")
response.write(i)
response.write("<br>")
if catgebruikt then
finanSQL = _
"UPDATE intakeformulieren_financien " & _
"SET bedragdeelnemer=" & replace(bedragdeelnemer, ",", ".") & _
", volgnummer=" & volgnummer & _
", cbvcode='" & cbvcode & _
"' WHERE formuliernr = " & formnummer & _
" AND cat_id = " & cat_id
response.write(finanSQL)
catgebruikt = FALSE
else
finanSQL = _
"INSERT INTO " & _
"intakeformulieren_financien (formuliernr, bedragdeelnemer, cat_id, volgnummer, cbvcode) " & _
"VALUES ("& & _
formnummer & "," & _
replace(bedragdeelnemer, ",", ".") & "," & _
cat_id & "," & _
volgnummer & ",'" & _
cbvcode & "')"
response.write(finanSQL)
end if
objConProjecten.Execute(finanSQL)
uitgevoerd=uitgevoerd+1
i=i+1
end if
Loop
答案 0 :(得分:0)
这就是我最终做到的。它的工作原理:)谢谢!
Do until Int(uitgevoerd)=Int(aantal_cat)
Do until Not IsEmpty(request.form("categorie" & i))
i=i+1
loop
cbvcode = request.form("cbvcode" & i)
Select Case True
Case Instr(cbvcode, "-1") > 0
'objConProjecten.Execute(finanSQL)
uitgevoerd=uitgevoerd+1
i=i+1
Case else
...
...
End Select
Loop
答案 1 :(得分:-2)
这是一个问题:
finanSQL = "INSERT INTO intakeformulieren_financien (formuliernr, bedragdeelnemer, cat_id, volgnummer, cbvcode) " &_
"VALUES ("& formnummer & "," & replace(bedragdeelnemer, ",", ".") & "," & cat_id & "," & volgnummer & ",'" & cbvcode & "')"
因为你有&#34;&amp; _&#34;而不是&#34;&amp; _&#34 ;.下划线必须是孤立的。它可能会破坏您代码中的内容。
我看到的另一个问题是你的 Select Case True 。我喜欢 Select Case true ,但你没有任何背后的东西可以使用它。您没有结束选择,也没有任何案例没有被注释掉。尝试删除整行。
再试一次,发布新代码,并告诉我们它是否仍然无效。啊,请做一个更好的缩进。