一下asp程序只能显示一个主题的汇总结果,如何加入一条循环语句,使所有的主题的汇总结果都显示出来,哥哥弟弟们帮帮我。怎么加sql语句?
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票结果显示</title>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0"
cellspacing="1" bgcolor="#999999" >
<tr>
<td width="746" height="30" bgcolor="#FFFFFF">
<table width="100%" border="0">
<tr>
<td width="516">投票结果显示
</td>
<%
Tid=request("tid"
openDB
set rs=conn.execute("select title,allvote from title where id="&Tid)
title=rs("title"
allvote=rs("allvote"
rs.close
set rs=nothing
sql="select options,vote from options where Tid="&Tid
set rso=Server.CreateObject("ADODB.Recordset"
rso.open sql,conn,1,1
nn=rso.recordcount
%>
<%
Tid=request("tid"
int a
a=clng(Tid)+1
theid=cstr(a) %>
<td width="120"><a href="voteshowall.asp">汇总投票结果</a></td>
<td width="90"><a href="index.asp?theid=<%=a%>">下一主题</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="746" height="147" valign="top" bgcolor="#F0F0F0">
<table width="505" height="126" border="0" align="center">
<tr>
<td colspan="2">主题:<%=title%>
</td>
</tr>
<%
for i=1 to nn
if allvote=0 then
percent=0
else
percent=(rso("vote"
/allvote)*100
end if
response.Write "<tr><td>["&i&"]"&rso("options"
&"</td>"&_
"<td><img src='pic.gif' height=11 width="&percent&"> "&_
formatnumber(percent,1)&"%["&rso("vote"
&"人]</td></tr>"
rso.movenext
next
rso.close
set rso=nothing
closeDB
%>
<tr>
<td colspan="2">总投票数:<%=allvote%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>