高手请指教
我想把数据库数据调成2个部分,请问循环语句该怎么写啊? ?
<table width="590" height="179" border="0" align="center" cellpadding="3" >
<%RecCount = objRS.RecordCount
if RecCount < 1 then Response.Write("暂无分类<br>")
%>
<%do while RecCount > 0%>
<%for i = 0 to 2 : tmpid(i) = NULL : next%>
<tr>
<td width="33%" valign="top"><p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p></td>
<%tmpid(0) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<td width="33%" valign="top"><%if RecCount > 0 then%>
<p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p>
<%tmpid(1) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<%end if%></td>
<td width="34%" valign="top"><%if RecCount > 0 then%>
<p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p>
<%tmpid(2) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<%end if%></td>
</tr>
<tr>
<td width="33%" class="0" valign="top"><%
sql = "select * from shortcut where rootID = " & tmpid(0)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
</td>
<td width="33%" class="0" valign="top"><%
if not IsNull(tmpid(1)) then
sql = "select * from shortcut where rootID = " & tmpid(1)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
<%end if%>
</td>
<td width="34%" class="0" valign="top"><%
if not IsNull(tmpid(2)) then
sql = "select * from shortcut where rootID = " & tmpid(2)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
<%end if%>
</td>
</tr>
<tr>
<td width="33%" height="10" colspan="3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="4"></td>
</tr>
</table></td>
</tr>
<%loop%>
</table>
<table width="590" height="179" border="0" align="center" cellpadding="3" >
<%RecCount = objRS.RecordCount
if RecCount < 1 then Response.Write("暂无分类<br>")
%>
<%do while RecCount > 0%>
<%for i = 0 to 2 : tmpid(i) = NULL : next%>
<tr>
<td width="33%" valign="top"><p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p></td>
<%tmpid(0) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<td width="33%" valign="top"><%if RecCount > 0 then%>
<p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p>
<%tmpid(1) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<%end if%></td>
<td width="34%" valign="top"><%if RecCount > 0 then%>
<p align="left"><b><a href="fenlei.asp?sortid=<%=objRS("ID")%>" title="<%=objRS("description")%>"><%=objRS("sortName")%></a></b></p>
<%tmpid(2) = objRS("ID") : objRS.MoveNext() : RecCount = RecCount - 1%>
<%end if%></td>
</tr>
<tr>
<td width="33%" class="0" valign="top"><%
sql = "select * from shortcut where rootID = " & tmpid(0)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
</td>
<td width="33%" class="0" valign="top"><%
if not IsNull(tmpid(1)) then
sql = "select * from shortcut where rootID = " & tmpid(1)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
<%end if%>
</td>
<td width="34%" class="0" valign="top"><%
if not IsNull(tmpid(2)) then
sql = "select * from shortcut where rootID = " & tmpid(2)
Set objShortCut = objConn.Execute(sql)
do while not objShortCut.EOF
%>
<a href="fenlei.asp?sortid=<%=objShortCut("sortID")%>" title="<%=objShortCut("description")%>"><%=objShortCut("sortName")%></a>
<%objShortCut.MoveNext%>
<%loop%>
<%end if%>
</td>
</tr>
<tr>
<td width="33%" height="10" colspan="3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="4"></td>
</tr>
</table></td>
</tr>
<%loop%>
</table>
...全文


