克里斯汀娜的微博:asp中取自动循环变量的最大值问题

来源:百度文库 编辑:高校问答 时间:2024/05/06 03:09:45
在程序中,我用i=0,i=i+1自动循环,最后怎样取i的最大值,即最后一次循环的值?
i=0
'数据库操作
if productlist<>"" then
%>

<%
sql="select * from product where id in ("&productlist&") order by id"
Set rs = conn.Execute( sql )
'response.write sql
else
end if

'On Error Resume Next
Sum = 0
While Not rs.EOF
i=i+1

%>

<tr>
<td height="18" width="18%">所买的商品种类<%=max(i)%></td>

<%
sql="select * from product where id in ("&productlist&") order by id"
Set rs = conn.Execute( sql )
'response.write sql
else
end if

'On Error Resume Next
rs.movefirst
do While Not (rs.EOF and rs.bof )
rs.movenext
loop

%>

<tr>
<td height="18" width="18%">所买的商品种类<%rs.recordcount%></td>

试试看吧~

Response.Write (i-1)