📄 scorequery1_2.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/StudentConn.asp" -->
<%
Dim strStudentNum, strName, strGrade, strClass
strSubject=Trim(Request("Subject"))
strStudentNum= Request("StudentNum")
strName=Request("Name")
strGrade=Request("Grade")
strClass=Request("ClassSelect")
Dim Recordset1__MMColParam
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_StudentConn_STRING
if (strStudentNum <> "") then
Recordset1__MMColParam =strStudentNum
Recordset1.Source = "SELECT StudentNum,Name FROM StudentInfo WHERE StudentNum like '%" & Recordset1__MMColParam & "%' ORDER BY StudentNum"
elseif (strName<>"") then
Recordset1__MMColParam =strName
Recordset1.Source = "SELECT StudentNum,Name FROM StudentInfo WHERE StudentNum like '%" & Recordset1__MMColParam & "%' ORDER BY StudentNum"
else
If len(Year(Now()))<=2 Then
NewYear="20" & Year(Now())
Else
NewYear=Year(Now())
End If
If len(Month(Now()))<=1 Then
NewMonth="0" & Month(Now())
Else
NewMonth=Month(Now())
End If
if NewMonth<9 then
strStudentNum=NewYear-strGrade-1
else
strStudentNum=NewYear-strGrade
end if
if strClass="All" then strClass=""
if Len(strClass)=1 then
strClass="0" & strClass
end if
Recordset1__MMColParam =strStudentNum & strClass
Recordset1.Source = "SELECT StudentNum,Name FROM StudentInfo WHERE StudentNum like '" & Recordset1__MMColParam & "%' ORDER BY StudentNum"
end if
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
If (Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (Recordset1_total = -1) Then
' count the total records by iterating through the recordset
Recordset1_total=0
While (Not Recordset1.EOF)
Recordset1_total = Recordset1_total + 1
Recordset1.MoveNext
Wend
' reset the cursor to the beginning
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
' set the number of rows displayed on this page
If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>学生成绩查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2600.0" Name=GENERATOR>
<link href="home.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<!--#include file="Top.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center border=0>
<TR>
<TD vAlign=top width=46 background=images/p_left_2.gif></TD>
<TD width=20> </TD>
<TD valign="top"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<tr>
<td height=30 width="20%"><img src="images/friendsite.GIF" width="19" height="19">
<a href="ScoreInputStep1.asp">录入学生成绩</a></td>
<td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19">
<a href="ScoreQueryStep1.asp">查询学生成绩</a></td>
<td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19">
<a href="ScoreModifyDel.asp">修改/删除学生成绩</a></td>
<td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19">
<a href="ScoreOrder.asp">计算总分与排名</a></td>
<td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19"><a href="TargetManage.asp">目标分管理</a></td>
</tr>
</TABLE>
<table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="center" valign="top"> <b><font color="#0066cc" size="5"><br>
学生成绩查询</font></b> </td>
</tr>
<tr>
<td bgcolor=#3399ff height=1></td>
</tr>
<tr>
<td valign=top><b><font color="#FF0000"><br>
<font color="#0066cc">科目名称:</font></font></b> <%=strSubject%><font color="#FF0000"><b><font color="#0066cc"> </font></b></font><font color="#FF0000"><b> 查询条件:</b></font>
<%
if Request("StudentNum")<>"" then
response.write "学号中含有“" & strStudentNum & "”"
elseif strName<>"" then
response.write "姓名中含有“" & strName & "”"
else
if strClass<>"" then strClass=strClass & "班"
response.write "高" & strGrade+1 & "级" & strClass
end if
%>
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<br><br>
共找到 <font color="#FF0000"><%=(Recordset1_total)%></font> 条记录!
<table cellspacing=0 border=1 cellpadding="0" bordercolor="#FFCC00">
<tr align="center" valign="middle" bordercolor="#FFCC00">
<td width="60" rowspan="2"><font color="#000000">学 号</font></td>
<td width="50" rowspan="2"><font color="#000000">姓 名</font></td>
<td width="50" rowspan="2"><font color="#000000">目 标</font></td>
<%
dim arrSheetName
dim strSheetName
dim rsSubjects()
dim ArrPass(),ArrExcel(),ArrAttain(),ArrBeyond()
strTemp = Request("chkbox")
arrSheetName = split(strTemp,",")
ReDim ArrPass(UBound(arrSheetName)+1)
Redim ArrExcel(UBound(arrSheetName)+1)
Redim ArrAttain(UBound(arrSheetName)+1)
Redim ArrBeyond(UBound(arrSheetName)+1)
Redim rsSubjects(Ubound(arrSheetName)+1)
For i = LBound(arrSheetName) To UBound(arrSheetName)
strSheetName=trim(cstr(arrSheetName(i)))
Dim rsTestName__MMColParam
rsTestName__MMColParam=strSheetName
set rsTestName = Server.CreateObject("ADODB.Recordset")
rsTestName.ActiveConnection = MM_StudentConn_STRING
rsTestName.Source = "SELECT SheetName, TestName FROM TestName WHERE SheetName = '" + Replace(rsTestName__MMColParam, "'", "''") + "'"
rsTestName.CursorType = 0
rsTestName.CursorLocation = 2
rsTestName.LockType = 3
rsTestName.Open()
rsTestName_numRows = 0
strTestName=rsTestName.Fields.Item("TestName")
strTestName=left(strTestName,len(strTestName)\2) & "<br>" & mid(strTestName,len(strTestName)\2+1,len(strTestName))
response.write "<td height='20' colspan='2'><font color='#000000'>" & strTestName & "</font></td>"
ArrPass(i)=0
ArrExcel(i)=0
ArrAttain(i)=0
ArrBeyond(i)=0
next
%>
</tr>
<tr align="center" valign="middle" bordercolor="#FFCC00">
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
if strSubject<>"全级排名" and strSubject<>"班级排名" then
response.write "<td height='20'><font color='#000000'>成绩</font></td><td height='20'><font color='#000000'>达标否</font></td>"
else
response.write "<td height='20'><font color='#000000'>名次</font></td><td height='20'><font color='#000000'>达标否/font></td>"
end if
next
%>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
strSheetName=trim(cstr(arrSheetName(i)))
set rsSubjects(i) = Server.CreateObject("ADODB.Recordset")
rsSubjects(i).ActiveConnection = MM_StudentConn_STRING
rsSubjects__MMColParam =CStr(Recordset1.Fields.Item("StudentNum"))
rsSubjects(i).Source = "SELECT " & strSubject & " FROM " & strSheetName & " WHERE StudentNum = '" + Replace(rsSubjects__MMColParam,"'","''") + "'"
rsSubjects(i).CursorType = 0
rsSubjects(i).CursorLocation = 2
rsSubjects(i).LockType = 3
rsSubjects(i).Open()
next
%>
<%
rsTarget__MMColParam = CStr(Recordset1.Fields.Item("StudentNum").Value)
set rsTarget = Server.CreateObject("ADODB.Recordset")
rsTarget.ActiveConnection = MM_StudentConn_STRING
rsTarget.Source = "SELECT " & strSubject & " FROM TargetScore WHERE StudentNum = '" + Replace(rsTarget__MMColParam, "'", "''") + "'"
rsTarget.CursorType = 0
rsTarget.CursorLocation = 2
rsTarget.LockType = 3
rsTarget.Open()
rsTarget_numRows = 0
if rsTarget.bof or rsTarget.eof then
Target=0
else
Target=rsTarget.Fields.Item(strSubject).Value
if IsNull(Target) then Target=0
end if
%>
<tr align="center" valign="middle">
<td height="20" nowrap><%=(Recordset1.Fields.Item("StudentNum").Value)%></td>
<td height="20" nowrap><%=(Recordset1.Fields.Item("Name").Value)%></td>
<td height="20"><%=(Target)%></td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
if rsSubjects(i).bof or rsSubjects(i).eof then
strScore=0
else
strScore=rsSubjects(i).Fields.Item(strSubject).Value
if IsNull(strScore) then strScore=0
end if
if strScore<60 then
if strScore>=Target then '达标
ArrAttain(i)=ArrAttain(i)+1
strTarget="<font color='#999999'>达标</font>"
else '不达标
strTarget="<font color='#ff0000'>不达标</font>"
end if
strScore = "<font color='#ff0000'>" & strScore & "</font>"
elseif strScore>=60 and strScore<80 then
ArrPass(i)=ArrPass(i)+1
if strScore>=Target then
if Target<60 then '跳格
ArrBeyond(i)=ArrBeyond(i)+1
strTarget="<font color='#009900'>跳格</font>"
else '达标
ArrAttain(i)=ArrAttain(i)+1
strTarget="<font color='#999999'>达标</font>"
end if
else '不达标
strTarget="<font color='#ff0000'>不达标</font>"
end if
elseif strScore>=80 then
ArrPass(i)=ArrPass(i)+1
ArrExcel(i)=ArrExcel(i)+1
if strScore>=Target then
if Target<80 then '跳格
ArrBeyond(i)=Arrbeyond(i)+1
strTarget="<font color='#009900'>跳格</font>"
else '达标
ArrAttain(i)=ArrAttain(i)+1
strTarget="<font color='#999999'>达标</font>"
end if
else '不达标
strTarget="<font color='#ff0000'>不达标</font>"
end if
strScore = "<font color='#009900'>" & strScore & "</font>"
end if
response.write "<td height='20'>" & strScore & "</td>"
response.write "<td height='20'>" & strTarget & "</td>"
next
%>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
<tr align="center" valign="middle">
<td colspan="3" hight="20" align="right">合格人数/达标人数:</td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
response.write "<td height='20'>" & ArrPass(i) & "</td><td height='20'>" & ArrAttain(i) & "</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="3" hight="20" align="right">合格率/达标率:</td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
response.write "<td height='20'>" & round(ArrPass(i)/(Recordset1_total)*100,1) & "%</td><td height='20'>" & round(ArrAttain(i)/(Recordset1_total)*100,1) & "%</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="3" hight="20" align="right">优秀人数/跳格人数:</td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
response.write "<td height='20'>" & ArrExcel(i) & "</td><td height='20'>" & ArrBeyond(i) & "</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="3" hight="20" align="right">优秀率/跳格率:</td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
response.write "<td height='20'>" & round(ArrExcel(i)/(Recordset1_total)*100,1) & "%</td><td height='20'>" & round(ArrBeyond(i)/(Recordset1_total)*100,1) & "%</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="3" hight="20" align="right">两率和:</td>
<%
For i = LBound(arrSheetName) To UBound(arrSheetName)
response.write "<td height='20'>" & round((ArrPass(i)+ArrExcel(i))/(Recordset1_total)*100,1) & "%</td><td height='20'>" & round((ArrAttain(i)+ArrBeyond(i))/(Recordset1_total)*100,1) & "%</td>"
next
%>
</tr>
</table>
<font color="#000000"><strong>说明:</strong><br>
成绩表示方法:60分以下用<font color="#FF0000">红色</font>表示,60--79分用<font color="#0000FF">蓝色</font>表示,80分及以上用<font color="#009900">绿色</font>表示。<br>
达标表示方法:不达标用<font color="#FF0000">红色</font>表示,达标用</font><font color="#999999">灰色</font><font color="#000000">表示,跳格用<font color="#009900">绿色</font>表示。</font>
<% else %> <br> <br> <br>
找不到符合条件的记录!<br> <br> <br> <% end if %> </td>
</tr>
</table>
</TD>
</TR>
</TABLE>
<!--#include file="CopyRight.asp"-->
</BODY>
</HTML>
<%
Recordset1.Close()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -