📄 scorequery1_1_2.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/StudentConn.asp" -->
<%
Dim rsTestName__MMColParam,rsScore__MMColParam
Dim strSheetName, strStudentNum, strName, strGrade, strClass,strSubjects
strSheetName = Request("SheetName")
strSubjects = strSheetName & "." & Replace(Request("chkbox"),", ",", " & strSheetName & ".")
rsTestName__MMColParam = Request("SheetName")
Session("txtSheetName")=Request("SheetName")
%>
<%
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
%>
<%
strStudentNum= Request("StudentNum")
strName=Request("Name")
strGrade=Request("Grade")
strClass=Request("ClassSelect")
set rsScore = Server.CreateObject("ADODB.Recordset")
rsScore.ActiveConnection = MM_StudentConn_STRING
strSQL = "Select " & strSheetName & ".StudentNum, StudentInfo.Name, " & strSubjects & " From " & strSheetName
strSQL = strSQL & " LEFT JOIN StudentInfo ON " & strSheetName & ".StudentNum = StudentInfo.StudentNum"
if (strStudentNum <> "") then
strSQL = strSQL & " Where " & strSheetName & ".StudentNum Like '%" & strStudentNum & "%'"
elseif (strName<>"") then
strSQL = strSQL & " Where StudentInfo.Name Like '%" & strName & "%'"
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
strSQL = strSQL & " Where " & strSheetName & ".StudentNum Like '%" & strStudentNum & strClass & "%'"
end if
strSQL = strSQL & " ORDER BY " & strSheetName & ".StudentNum"
rsScore.Source = strSQL
rsScore.CursorType = 0
rsScore.CursorLocation = 2
rsScore.LockType = 3
rsScore.Open()
rsScore_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsScore_numRows = rsScore_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsScore_total
Dim rsScore_first
Dim rsScore_last
' set the record count
rsScore_total = rsScore.RecordCount
' set the number of rows displayed on this page
If (rsScore_numRows < 0) Then
rsScore_numRows = rsScore_total
Elseif (rsScore_numRows = 0) Then
rsScore_numRows = 1
End If
' set the first and last displayed record
rsScore_first = 1
rsScore_last = rsScore_first + rsScore_numRows - 1
' if we have the correct record count, check the other stats
If (rsScore_total <> -1) Then
If (rsScore_first > rsScore_total) Then
rsScore_first = rsScore_total
End If
If (rsScore_last > rsScore_total) Then
rsScore_last = rsScore_total
End If
If (rsScore_numRows > rsScore_total) Then
rsScore_numRows = rsScore_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rsScore_total = -1) Then
' count the total records by iterating through the recordset
rsScore_total=0
While (Not rsScore.EOF)
rsScore_total = rsScore_total + 1
rsScore.MoveNext
Wend
' reset the cursor to the beginning
If (rsScore.CursorType > 0) Then
rsScore.MoveFirst
Else
rsScore.Requery
End If
' set the number of rows displayed on this page
If (rsScore_numRows < 0 Or rsScore_numRows > rsScore_total) Then
rsScore_numRows = rsScore_total
End If
' set the first and last displayed record
rsScore_first = 1
rsScore_last = rsScore_first + rsScore_numRows - 1
If (rsScore_first > rsScore_total) Then
rsScore_first = rsScore_total
End If
If (rsScore_last > rsScore_total) Then
rsScore_last = rsScore_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="ScoreManage_Top.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
<TR>
<TD valign="top" bgcolor="#F2FBF2"><img src="images/ScoreQurey_Title.GIF" width="500" height="60"><font size="5"><strong>按考试查询方式</strong></font><br>
<br>
<b><font color="#FF0000">
考试名称:</font></b> <%=(rsTestName.Fields.Item("TestName").Value)%><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 rsScore.EOF Or Not rsScore.BOF Then %>
共找到 <font color="#FF0000"><%=(rsScore_total)%></font> 条记录!
<table cellspacing=0 border=1 cellpadding="0" bordercolor="#FFCC00">
<tr align="center" valign="middle" bordercolor="#FFCC00">
<td width="60"><font color="#000000"><strong>学 号</strong></font></td>
<td width="50"><font color="#000000"><strong>姓 名</strong></font></td>
<%
strTemp = Request("chkbox")
dim ArrSubject,strSubject
dim ArrPass(),ArrExcel(),ArrAttain(),ArrBeyond()
ArrSubject = split(strTemp,",")
ReDim ArrPass(UBound(ArrSubject)+1)
Redim ArrExcel(UBound(ArrSubject)+1)
Redim ArrAttain(UBound(ArrSubject)+1)
Redim ArrBeyond(UBound(ArrSubject)+1)
For i = LBound(ArrSubject) To UBound(ArrSubject)
strSubject=trim(cstr(ArrSubject(i)))
response.write "<td height='20'><font color='#000000'><b>" & strSubject & "</b></font></td>"
ArrPass(i)=0
ArrExcel(i)=0
ArrAttain(i)=0
ArrBeyond(i)=0
next
%>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsScore.EOF))
%>
<%
strName=cstr(rsScore.Fields.Item("Name").Value)
if strName="" then strName=" "
%>
<tr align="center" valign="middle">
<td height="20" nowrap><font color="#000000"><%=(rsScore.Fields.Item("StudentNum").Value)%></font></td>
<td height="20" nowrap><font color="#000000"><%=strName%></font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
strSubject=trim(cstr(ArrSubject(i)))
strScore=rsScore.Fields.Item(strSubject).Value
if IsNull(strScore) then strScore=0
if strScore<60 then
strScore = "<font color='#ff0000'>" & strScore & "</font>"
elseif strScore>=60 and strScore<80 then
ArrPass(i)=ArrPass(i)+1
strScore = "<font color='#0000ff'>" & strScore & "</font>"
elseif strScore>=80 then
ArrPass(i)=ArrPass(i)+1
ArrExcel(i)=ArrExcel(i)+1
strScore = "<font color='#009900'>" & strScore & "</font>"
end if
response.write "<td height='20'>" & strScore & "</td>"
next
%>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsScore.MoveNext()
Wend
%>
<tr align="center" valign="middle">
<td colspan="2" hight="20" align="right"><font color="#000000">合格人数:</font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
response.write "<td height='20'>" & ArrPass(i) & "</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="2" hight="20" align="right"><font color="#000000">合格率:</font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
response.write "<td height='20'>" & round(ArrPass(i)/(rsScore_total)*100,1) & "%</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="2" hight="20" align="right"><font color="#000000">优秀人数:</font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
response.write "<td height='20'>" & ArrExcel(i) & "</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="2" hight="20" align="right"><font color="#000000">优秀率:</font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
response.write "<td height='20'>" & round(ArrExcel(i)/(rsScore_total)*100,1) & "%</td>"
next
%>
</tr>
<tr align="center" valign="middle">
<td colspan="2" hight="20" align="right"><font color="#000000">两率和:</font></td>
<%
For i = LBound(ArrSubject) To UBound(ArrSubject)
response.write "<td height='20'>" & round((ArrPass(i)+ArrExcel(i))/(rsScore_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
Response.Write "<br><br><br>找不到符合条件的记录!<br><br><br>"
end if
%>
</TD>
</TR>
</TABLE>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<Iframe src="http://cqzx.sdedu.net/sdms/CopyRight.asp" width="760" height="200" marginheight="0" marginwidth="0" scrolling="NO" frameborder="0" name="CopyRight"></iframe>
</td>
</tr>
</table></BODY>
</HTML>
<%
rsTestName.Close()
%>
<%
rsScore.Close()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -