此代码背后的基本概念是,无论何时运行,元素的数量减少,来自同一元素但来自不同数组的数量增加。无论出于何种原因,第二个while循环只运行一次并停止。例如,如果total1 = 11
和total2 = 0
是第一次执行代码,total1 = 10
和total2 = 1
。但在此之后,total1 = 9
和total2 = 1
等等。谁能告诉我我的代码有什么问题?任何和所有的帮助将不胜感激。
<%
count = 0
do while NOT rs3.EOF
if rs3("ITEM_NO") = itemnum then
qtyArray(count) = qtyArray(count) - qtyreq
end if
if qtyArray(count) >= 0 and rs3("ITEM_NO") = itemnum then
total1 = total1 - qtyreq
end if
count = count + 1
rs3.MoveNext
loop
rs3.MoveFirst
pickcount = 0
do while NOT rs3.EOF
if qtyPick(pickcount) >= 0 and rs3("ITEM_NO") = itemnum then
qtyPick(pickcount) = qtyPick(pickcount) + qtyreq
total2 = total2 + qtyreq
end if
rs3.MoveNext
pickcount = pickcount + 1
loop
%>
答案 0 :(得分:0)
total2 = total2 + qtyreq
请确保“qtyreq”变量不为0,并且确实为您的总数增加了+1。
答案 1 :(得分:0)
第二个循环pickcount = pickcount + 1
上有一行。只需将此行移到第二个循环的行rs3.MoveNext