通过班级和科目来统计学生成绩,然后在另外一个页面显示出来,可是有时候行,有时候不行,为什么啊, ?帮帮小女子,我把全部文件上传了,把全部复制在一起就可以用了,问题在那个学生成绩统计页面,
第一页代码如下·
<form action="print4.asp" method="post" name="form1" target="_blank">
<table width="598" height="43" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0080FF" bordercolorlight="#DDEEFF" bgcolor="#FFFFFF">
<tr>
<td height="18" colspan="3">科目:
<label> </label> </td>
<td width="159"><select name="vkm" id="select2">
<%
mysql="select * from topic"
set myobj=getsqlrecordset(mysql,"stu_mis.mdb")
do while not myobj.eof %>
<option><%=myobj("科目")%></option>
<%myobj.movenext
loop%>
</select></td>
<td width="169">班级:</td>
<td width="89"><select name="vbj" id="select">
<% dim mysql
mysql="select * from class"
set myobj=getsqlrecordset(mysql,"stu_mis.mdb")
do while not myobj.eof %>
<option><%=myobj("班级")%></option>
<%myobj.movenext
loop%>
</select></td>
</tr>
<tr>
<td width="44" height="23">操作</td>
<td width="50"><input name="cz" type="submit" id="cz2" value="确定"></td>
<td colspan="4"> </td>
</tr>
</table>
</form>
第二页代码是
<table width="600" height="36" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0080FF" bordercolorlight="#DDEEFF" bgcolor="#FFFFFF">
<tr>
<td width="55"><div align="center">科目</div></td>
<td width="55"><div align="center">班级</div></td>
<td width="55" height="14"><div align="center">最低分</div></td>
<td width="56"><div align="center">最高分</div></td>
<td width="59"><div align="center">平均分</div></td>
<td width="60"><div align="center">不及格率</div></td>
<td width="56"><div align="center">合格率</div></td>
<td width="63"><div align="center">良好率</div></td>
<td width="59"><div align="center">优秀率</div></td>
</tr>
<% dim vkm , vbj
vkm=trim(request.Form("vkm"))
vbj=trim(request.Form("vbj"))
mysql1="drop table kmb"
mysql2="create table kmb(编号 COUNTER,最低分 float,最高分 float,平均分 float,不及格 integer,合格 integer,良好 integer,优秀 integer,总数 integer)"
mysql3="insert into kmb(最低分,最高分,平均分,不及格,合格,良好,优秀,总数) select min(分数),max(分数),avg(分数),"
mysql3=mysql3&"(select count(*) from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"' and 分数<60),"
mysql3=mysql3&"(select count(*) from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"' and 分数 between 60 and 74 ),"
mysql3=mysql3&"(select count(*) from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"' and 分数 between 75 and 84 ),"
mysql3=mysql3&"(select count(*) from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"' and 分数 between 85 and 100 ),"
mysql3=mysql3&"(select count(*) from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"')"
mysql3=mysql3&"from stu_cj where 科目='"&vkm&"' and 所在班级='"&vbj&"'"
mysql4="select * from kmb"
if request.Form("cz")="确定" then
set myobj=getsqlrecordset(mysql1,"stu_mis.mdb")
set myobj=getsqlrecordset(mysql2,"stu_mis.mdb")
set myobj=getsqlrecordset(mysql3,"stu_mis.mdb")
set myobj=getsqlrecordset(mysql4,"stu_mis.mdb")
end if
if myobj.eof then
zdf="无"
zgf="无"
pjf="无"
else
do while not myobj.eof
zdf=myobj("最低分")
zgf=myobj("最高分")
pjf=myobj("平均分")
bjg=myobj("不及格")
hg=myobj("合格")
lh=myobj("良好")
yx=myobj("优秀")
zs=myobj("总数")
%>
<tr>
<td width="55"><div align="center"><%=request.Form("vkm")%></div></td>
<td width="55"><div align="center"><%=request.Form("vbj")%></div></td>
<td width="55" height="20"><div align="center"> <%=zdf%></div></td>
<td width="56"><div align="center"><%=zgf%></div></td>
<td width="59"><div align="center"><%=pjf%></div></td>
<td width="60"><div align="center"><%=round((bjg/zs)*100)%>%</div></td>
<td width="56"><div align="center"><%=round((hg/zs)*100)%>%</div></td>
<td width="63"><div align="center"><%=round((lh/zs)*100)%>%</div></td>
<td width="59"><div align="center"><%=round((yx/zs)*100)%>%</div></td>
</tr>
<%myobj.movenext
loop%>
<table width="400" border="0" cellpadding="0" cellspacing="0" align="center" height="8">
<td align="center" ><span class="style3"><p>单科成绩分布统计分析图</p></span> </td>
</table>>
<table width="600" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#C
<!--DWLayoutTable-->
<tr>
<td width="40" height="88"></td>
<td width="40"></td>
<td width="40"></td>
<td width="40"></td>
<td width="40"></td>
</tr>
<!--DWLayoutTable-->
<tr>
<td valign="bottom" >不及格人数:<%=bjg%><img src="image/code1.jpg" height="<%=round((bjg/zs)*100)*2%>" width="20"></td>
<td valign="bottom">合格人数:<%=hg%><img src="image/code2.jpg" height="<%=round((hg/zs)*100)*2%>" width="20"></td>
<td valign="bottom">良好人数:<%=lh%><img src="image/code3.jpg" height="<%=round((lh/zs)*100)*2%>" width="20"></td>
<td valign="bottom">优秀人数:<%=yx%><img src="image/code4.jpg" height="<%=round((yx/zs)*100)*2%>" width="20"></td>
<td> </td>
</tr>
<tr height="10">
</tr>
</table>
<%end if %>
</table>
[此贴子已经被作者于2006-5-22 23:20:12编辑过]