主题:请高手指点,急!!
<% j=4
for n=0 to 2
i=j*n+1
do while not rs.EOF or rs.BOF
if i>(n+1)*j then
response.write"</tr>"
exit do
end if
While i<=rs("order")
If i=rs("order") then
%>
<td width=220 align=center>数据
<%=i%>
</td>
<%else%>
<td width=220 align=center>
<%=i%>
</td>
<% End if
i=i+1
wend
rs.movenext
loop
next
end if
set rs=nothing
set conn=nothing
%>
如上代码能正常输出数据库中数据形式如下:
数据 数据 数据 数据
1 2 3 4
数据 数据 数据 数据
5 6 7 8
数据 数据 数据 数据
9 10 11 12
---------------------------------
现在我想让它反过来显示如下:
数据 数据 数据 数据
9 10 11 12
数据 数据 数据 数据
5 6 7 8
数据 数据 数据 数据
1 2 3 4
把上面的代码for n=0 to 2 改成for n=2 to 0 step -1 之后,只能输出一行数据如下:
数据 数据 数据 数据
9 10 11 12
后面就没有了,即循环体只能执行一次。
请高手指点下,帮助解决这个问题。
for n=0 to 2
i=j*n+1
do while not rs.EOF or rs.BOF
if i>(n+1)*j then
response.write"</tr>"
exit do
end if
While i<=rs("order")
If i=rs("order") then
%>
<td width=220 align=center>数据
<%=i%>
</td>
<%else%>
<td width=220 align=center>
<%=i%>
</td>
<% End if
i=i+1
wend
rs.movenext
loop
next
end if
set rs=nothing
set conn=nothing
%>
如上代码能正常输出数据库中数据形式如下:
数据 数据 数据 数据
1 2 3 4
数据 数据 数据 数据
5 6 7 8
数据 数据 数据 数据
9 10 11 12
---------------------------------
现在我想让它反过来显示如下:
数据 数据 数据 数据
9 10 11 12
数据 数据 数据 数据
5 6 7 8
数据 数据 数据 数据
1 2 3 4
把上面的代码for n=0 to 2 改成for n=2 to 0 step -1 之后,只能输出一行数据如下:
数据 数据 数据 数据
9 10 11 12
后面就没有了,即循环体只能执行一次。
请高手指点下,帮助解决这个问题。