找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 403|回复: 4

[求助] 统计信息不准确.急!

[复制链接]
发表于 2010-1-17 08:50:57 | 显示全部楼层 |阅读模式 IP:江苏扬州
各位老师:
  烦请帮看一下以下代码为何在根据时间段统计时不准确?
我用了循环语句(红色)错在哪,请帮指点,为感!

<body>
<table border="1" width="649" id="table1" height="280">
<tr>
<td width="123" align="center" colspan="2" height="13"><font size="2">单位</font></td>
<td width="50" align="center" height="13"><font size="2">A类信息</font></td>
<td width="51" align="center" height="13"><font size="2">B类信息</font></td>
<td width="43" align="center" height="13"><font size="2">总篇数</font></td>
<td width="55" align="center" height="13"><font size="2">总分</font></td>
</tr>
<% set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from news where xxtype='A' and author='一部'"
rs.Open sqlstr,connstr,1,3
do while not rs.eof
if cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))>=cdate(dateb1) and cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))<=cdate(dateb2) then
yba=RS.RECORDCOUNT
ybsa=yba*1
end if
rs.movenext
loop
RS.CLOSE
sqlstr="select * from news where xxtype='B' and author='一部'"
rs.Open sqlstr,connstr,1,3
do while not rs.eof
if cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))>=cdate(dateb1) and cdate(year(rs("updatetime")) & "-" & month(rs("updatetime")) & "-" & day(rs("updatetime")))<=cdate(dateb2) then
ybb=RS.RECORDCOUNT
ybsb=ybb*3
end if
rs.movenext
loop
RS.CLOSE
if yba ="" then yba ="0"
if ybb ="" then ybb ="0"
%>

<tr>
<td width="41" valign="middle" align="center" rowspan="5" height="96"><font size="2">一队</font></td>
<td width="77" valign="middle" align="center" height="21"><font size="2">一部</font></td>
<td width="50" valign="middle" align="center" height="21"><font size="2"><%=yba%></font></td>
<td width="51" valign="middle" align="center" height="21"><font size="2"><%=ybb%> </font></td>
<td width="43" valign="middle" align="center" height="21"><font size="2"><%=yba+ybb%></font></td>
<td width="55" valign="middle" align="center" height="21"><font size="2"><%=ybsa+ybsb%></font></td>
</tr>
</body>
发表于 2010-1-17 08:51:01 | 显示全部楼层 IP:江苏扬州
你这里的循环用意是什么呢???
回复

使用道具 举报

发表于 2010-1-17 08:51:05 | 显示全部楼层 IP:江苏扬州
你写的程序谁都不会知道你要实现的是什么功能,所以下次麻烦你顺便说一下你这段代码要实现的是什么功能,以及出现的问题.
回复

使用道具 举报

发表于 2010-1-17 08:51:09 | 显示全部楼层 IP:江苏扬州
循环读出数据库中的所有数据呀,不对吗?

在统计中按时间段如果是从第一天到最后一天,那读出来的数据的正确的;如果是某一天或者某个时间段,那读出来的数据的不正确.

我数据库中的时间格式的2006-8-8 10:11:12 。我已将时间格式改为2006-8-8 用这句子代码是否正确?
year(rs("updatetime")) &amp; "-" &amp; month(rs("updatetime")) &amp; "-" &amp; day(rs("updatetime"))
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 11:27 , Processed in 0.209902 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表