请教一个低级asp中写多条SQL语句的问题,谢谢大家~
假设有数据库如下:
张三 男 39岁
李四 男 42岁
马五 男 32岁
牛二 女 31岁
胡一 女 21岁
如果现在让我把这张表展示在asp页面上我会,写个sql,select * from table,然后用循环语句把每条记录展示出来就行了
……
sql="select * from [btxh] order by usertime desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
……
Response.write("<table border=1 width='90%' cellspacing=1 align=center cellpadding=3 bordercolor=#ad8c42 style=BORDER-COLLAPSE: collapse;><tr><td align=center width='25%'><b>姓名</b></td><td align=center width='25%'><b>性别</b></td><td align=center width='25%'><b>年龄</b></td></tr>")
while (not rs.eof) and (not page_count = rs.pagesize)
dim x_xingming,x_xingbie,x_nianling
x_xingming =rs("xingming")
x_xingbie = rs("xingbie")
x_nianling = rs("nianling")
%>
<a id="msg<%=rs("id")%>">
<tr class="title2" align="center">
<td>
<% response.write x_xingming %>
</td>
<td>
<% response.write X_xingbie %>
</td>
<td>
<% response.write X_nianling %>
</td>
</tr>
<%
page_count = page_count + 1
rs.movenext
wend
%>
</table>
……
但现在我要实现如下目的:
在asp页面中用文字显示出来
本表共有5条记录,其中男性3名,女性2名,30岁以上4名,30岁以下1名……
这些5 3 2 4 1这些数字都是sql语句算出来的,其他中文的文字都是事先写好的
相当于要调用5个SQL语句
select count(*) from table
select count(*) from table where xingbie = "男"
select count(*) from table where xingbie = "你"
select count(*) from table where nianling > 30
select count(*) from table where nianling < 30
请问同时调用多个sql语句,这个asp代码怎么写呢?
我是初学者,可以看懂代码,但不会写,现在只会下些源代码下来自己看看为自己所用,所以麻烦大侠们写详细一点哦,谢谢~
谢谢大家~