⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scoreprintstep3_2.asp

📁 很好的学籍管理系统代码
💻 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")

intPageSize=Request("PageSize")
if intPageSize="" then intPageSize=3

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>
<style type="text/css">
<!--
TABLE {
	font-size: 12px;
	text-decoration: none;
}
-->
</style>
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=5 topMargin=5>
<TABLE cellSpacing=0 cellPadding=0 border=0>
  <TR> 
    <TD align="center" valign="top">
            <%
			 if Request("StudentNum")<>"" then
			     strTitle = "学号中含有“" & strStudentNum & "”"
			 elseif strName<>"" then
			     strTitle = "姓名中含有“" & strName & "”"
			 else
				 if strClass<>"" then strClass=strClass & "班" 
				 strTitle = "高" & strGrade+1 & "级" & strClass 
			 end if
			 strTitle = strTitle & strSubject & "成绩表"
			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)
				ArrPass(i)=0
				ArrExcel(i)=0
				ArrAttain(i)=0
				ArrBeyond(i)=0
			next
			
			If Not Recordset1.EOF Or Not Recordset1.BOF Then
				Recordset1.MoveFirst
				While Not Recordset1.EOF
					response.Write "<font size='6'><b>" & strTitle & "</b></font><br>"
					Repeat1__numRows = intPageSize

			 %> 
            <table cellspacing=0 border=1 cellpadding="0">
              <tr align="center" valign="middle"> 
                <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>
                <%
				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>"
				next
				%>
              </tr>
              <tr align="center" valign="middle"> 
                <%
				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
						strScore = "<font color='#0000ff'>" & strScore & "</font>"
					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
if Recordset1.EOF then
%>
              <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>
<% End if %>
      </table><br>
<%
	Wend
else 
	Response.Write "<br><br><br>找不到符合条件的记录!<br><br><br>"
end if
%>
		</TD>
  </TR>
</TABLE>
</BODY>
</HTML>
<%
Recordset1.Close()
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -