各位老师:
烦请帮看一下以下代码为何在根据时间段统计时不准确?
我用了循环语句(红色)错在哪,请帮指点,为感!
<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>