<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<P align=center><STRONG><FONT color=crimson face="" size=4>
<%=Request.QueryString("sub")%>课的考试成绩
</FONT></STRONG></P>
<P align=center><FONT color=dodgerblue face="" size=2>
任课教师:<%=Request("teachname")%>
</FONT></P>
<P align=center>
<TABLE border=0 cellPadding=1 cellSpacing=1 width=75%>
<TR bgcolor=Peachpuff>
<TD>姓名</TD>
<TD>成绩</TD>
<TD>名次</TD></TR>
<%
set conn=server.CreateObject("adodb.connection")
conn.ConnectionString="dsn=testsys"
conn.Open
'声明sql查询语句,从数据库中查询相应科目的考试成绩,查询结构按降序方式排序
strsql="SELECT score.score, studentinfo.stname FROM score,studentinfo where score.stid = studentinfo.stid and teachid='" & Request.QueryString("teachid") & "' and score.sub='" & Request.QueryString("sub") & "' ORDER BY score.score DESC"
set mrs=conn.Execute(strsql)
i=1
while not mrs.eof
'以表格的形式显示相应考试科目的成绩和学生姓名
Response.Write "<TR>"
Response.Write "<TD>"
Response.Write mrs("stname")
Response.Write "</TD>"
Response.Write "<TD>"
Response.Write mrs("score")
Response.Write "</TD>"
Response.Write "<TD>" & i & "</TD></TR>"
i=i+1
mrs.movenext
wend
conn.Close
set conn=nothing
%>
<TR bgcolor=Peachpuff><TD></TD><TD></TD><TD></TD></TR>
</TABLE>
</P>
</BODY>
</HTML>