asp中如何显示count(*)结果
<!--#includefile="conn.asp"--><%setrs=server.createobject("adodb.recordset")sql="sele...
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select top 10 loupan.L_name,count(*) from loupan,kehu where kehu.L_id=loupan.id group by loupan.L_name"
rs.open sql,conn,1,1
'num=rs(0)
'response.write(num)
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:2px">
<%
do while not rs.eof
%>
<tr>
<td width="15" align="center"></td>
<td width="60" height="25"><%=rs("L_name")%></td>
<td width="25" align="right" class="font_STYLE11" style="color:#FF0000"><%=rs(count(*))%>人 </td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%=rs(count(*))%>这个地方报错
</tr>
<%
rs.movenext
loop
%>
</table> 展开
<%
set rs=server.createobject("adodb.recordset")
sql="select top 10 loupan.L_name,count(*) from loupan,kehu where kehu.L_id=loupan.id group by loupan.L_name"
rs.open sql,conn,1,1
'num=rs(0)
'response.write(num)
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:2px">
<%
do while not rs.eof
%>
<tr>
<td width="15" align="center"></td>
<td width="60" height="25"><%=rs("L_name")%></td>
<td width="25" align="right" class="font_STYLE11" style="color:#FF0000"><%=rs(count(*))%>人 </td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%=rs(count(*))%>这个地方报错
</tr>
<%
rs.movenext
loop
%>
</table> 展开
展开全部
set rs=conn.execute("select count(Id) as num from 表名")
response.write(rs("num"))
response.write(rs("num"))
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用 <%=rs(1)%>
或者给字段一个别名
sql="select top 10 loupan.L_name,count(*) as [count] from loupan,kehu where kehu.L_id=loupan.id group by loupan.L_name"
<%=rs("count")%>
或者给字段一个别名
sql="select top 10 loupan.L_name,count(*) as [count] from loupan,kehu where kehu.L_id=loupan.id group by loupan.L_name"
<%=rs("count")%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
set rs=conn.execute("select count(Id) as num from 表名")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询