100分解决一个循环输出问题

oldwatch 2003-10-09 10:17:31
问题是这样的,我想在两个<td>里面循环输出同一个表的两个不同数据
具体如下:
<%dim i
i=0
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 9 newsname,newscontent,adddate,newsid from news order by adddate desc",conn,1,1
if rs.eof and rs.bof then%>
<TABLE WIDTH="100%" ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<!--DWLayoutTable-->
<tr>
<TD width="165" height="65" valign="top"> <%response.write "目前还没有新闻!"%> <%else
do while not rs.eof
i=i+1%> <%=trim(rs("newsname"))%> <%=trim(rs("newscontent"))%> <%if i>=9 then exit do
rs.movenext
loop
end if
rs.close
set rs=nothing%> </TD>
<TD width="604" valign="top"><!--DWLayoutEmptyCell-->  </TD>
</tr>
</TABLE>
上面的只是在一个<td>输出两个数据,怎样写才能把<%=trim(rs("newscontent"))%>放到第二个<TD width="604" valign="top"><!--DWLayoutEmptyCell-->  </TD>里面啊?请帮帮忙~
...全文
37 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
oldwatch 2003-10-09
  • 打赏
  • 举报
回复
很好~接分
Reker熊 2003-10-09
  • 打赏
  • 举报
回复
<%
Dim i
i=0
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 9 newsname,newscontent,adddate,newsid from news order by adddate desc",conn,1,1
if rs.eof and rs.bof then
%>
<TABLE WIDTH="100%" ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<tr>
<TD width="165" height="65" valign="top">
<%
Response.write "目前还没有新闻!"
Else
Do while not rs.eof
i=i+1
Response.Write trim(rs("newsname"))
If i>=9 then exit do
Rs.movenext
Loop
%>
</TD>
<TD width="604" valign="top">
<%
Rs.MoveFirst
Do while not rs.eof
i=i+1
Response.Write trim(rs("newscontent"))
If i>=9 then exit do
Rs.movenext
Loop
%>
 
</TD>
<%
rs.close
set rs=nothing
End If
%>
</tr>
</TABLE>

1,451

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 图象工具使用
社区管理员
  • 图象工具使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧