标题:select count(*)语句在asp中如何使用
只看楼主
jingjing316
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:293
专家分:541
注 册:2009-8-11
得分:0 
response.write "<table border=1 cellspacing=0 cellpadding=0>"
response.write"<th>参加考试的单位</th> "
response.write"&nbsp;&nbsp;&nbsp;&nbsp;"
response.write"<th>人数<th> "
'response.write"<br>"
sql3="select banji,count(banji) as num2 from tbuser ,tbscore where  tbscore.kcid="&kcid&" and tbscore.paperno="&paperno&"  and tbuser.username=tbscore.username group by banji"
Set rs3=server.CreateObject("adodb.recordset")
rs3.open sql3,conn,3,1
while not rs3.eof
response.write "<tr><td align=center>"
response.write rs3("banji")
response.write "</td>"
'response.write"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
response.write "<td align=center>"
response.write rs3("num2")
response.write "</td></tr>"
'response.write"<br>"
rs3.movenext
wend
rs3.close
'response.write"<hr>"
response.write "<table  border=1 cellspacing=0 cellpadding=0 align=left>"
response.write"<th>已经参加考试单位</th>"
response.write"&nbsp;&nbsp;&nbsp;&nbsp;"
response.write"<th>人数</th> "
'response.write"<br>"

sql4="select banji,count(banji) as num1 from tbuser ,tbscore where  tbscore.kcid="&kcid&" and tbscore.paperno="&paperno&" and  tbscore.isexam=1  and tbuser.username=tbscore.username group by banji"
Set rs4=server.CreateObject("adodb.recordset")
rs4.open sql4,conn,3,1
while not rs4.eof
response.write "<tr><td align=center>"
response.write rs4("banji")
response.write "</td>"
'response.write"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
response.write "<td align=center>"
response.write rs4("num1")
response.write "</td></tr>"

'response.write"<br>"
rs4.movenext
wend
代码如上,得到结果如图所示
,怎样写才能得到下面这种格式呢?

简单说就是让这两个表格并列排列。

[ 本帖最后由 jingjing316 于 2010-1-20 10:38 编辑 ]
2010-01-20 10:20
chenguoxing517
Rank: 7Rank: 7Rank: 7
来 自:广东广州
等 级:黑侠
威 望:1
帖 子:154
专家分:619
注 册:2009-9-28
得分:5 
像这种sql语句报错,一般采用的方法就是,在执行该sql语句前,打印出该sql语句,然后将其copy到相应的数据库中直接执行,错误就一目了然
2010-01-20 10:50
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
得分:5 
以下是引用jingjing316在2010-1-20 10:20:14的发言:

response.write "<table border=1 cellspacing=0 cellpadding=0>"
response.write"<th>参加考试的单位</th> "
response.write"&nbsp;&nbsp;&nbsp;&nbsp;"
response.write"<th>人数<th> "
'response.write"<br>"
sql3 ...
这个可是基础的html
先去找手册看看tr td吧
2010-01-20 11:19
jingjing316
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:293
专家分:541
注 册:2009-8-11
得分:0 
以下是引用aspic在2010-1-20 11:19:30的发言:

这个可是基础的html
先去找手册看看tr td吧
确实,已找到解决方法。

谢谢各位!辛苦辛苦!
2010-01-20 14:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-296016-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.412527 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved