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

📄 public.asp

📁 轩圆学生信息管理系统 081029修正了成绩数据浏览时查看单个学生成绩时总分排名显示表格问题。 //===============================================
💻 ASP
字号:
<%
'//系统名称
Const SiteName	 = "轩圆学生信息管理系统"
'//版本号
Const Ver		 = "V1.3.081029"
'//=======================================
Dim PStart
PStart = Timer

Sub PHead(strHeadTitle)
	Dim s
	s=LCase(Request.ServerVariables("SCRIPT_NAME"))
	Print "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"
	Print "<html xmlns=""http://www.w3.org/1999/xhtml"">"
	Print "<head>"
	Print "<title> "&Server.HTMLEncode(strHeadTitle)&" </title>"
	Print "<meta http-equiv=""Content-Type"" content=""text/html;charset=gb2312"" />"
	Print "<link href=""Style/css.css"" rel=""stylesheet"" type=""text/css"" />"
	Print "<script src=""JavaScript/JSFunction.js"" type=""text/javascript""></script>"
	Print "<script src=""JavaScript/MaxWindow.js"" type=""text/javascript""></script>"
	Print "<script src=""JavaScript/MovieDiv.js"" type=""text/javascript""></script>"
	Print "<script language=""javascript"">"
	Print "function killErrors(){"
	Print "	return true;}"
	Print "window.onerror = killErrors;"
	Print "</script>"
	Print "<style>"
	If InStr(s,"index.asp")=0 Then
		Print "body,html{width:97%;}"
	End If 
	Print "</style>"
	Print "</head>"
	Print "<body>"
End Sub

'----------------------------
'输出尾部HTML代码
'参数:是否有显示等待信息
'----------------------------
Sub PFoot()
	Print "</body>"
	Print "</html>"
	If IsObject(oConn) Then Call CloseConn()
End Sub

Sub Waiting()
	Call JavaScript("w();")
End Sub

Sub HWaiting()
	Call JavaScript("h();")
End Sub 

'//---单科成绩排名---
'//参数:学生ID,考试ID,科目ID,排名类别:(1,班级,2,年级),班级名称,成绩
Function KMPM(sID,ksID,kmID,PM,BJ,FS)
	Dim strSQL
	strSQL = "Select Count(分数) As pm From cjTable,sTable Where cjTable.ksID="&ksID&" And cjTable.kmID="&kmID&" And sTable.sID=cjTable.sID And cjTable.分数>"&FS&""
	If PM = 1 Then
		strSQL = strSQL & " And sTable.班级='"&BJ&"'"
	ElseIf PM = 2 Then
		'//加入文理科班级名次
		If Left(BJ,2)=(Right((CInt(Year(Date))+3),2)) Then '如果为一年级就不分文理班
			strSQL = strSQL & " And sTable.年级='"&Left(BJ,2)&"'"
		Else 
			'//判断是二年级或三年级
			If Left(BJ,2)=(Right("00"&(CInt(Year(Date))+2),2)) Then '二年级学生
				If InStr(LK2,BJ)>0 Then '理科班级
					strSQL = strSQL & " "&WL(LK2)&""					
				Else	'文科学生
					strSQL = strSQL & " "&WL(WK2)&""					
				End If 
			Else	'三年级学生
				If InStr(LK3,BJ)>0 Then '理科班级
					strSQL = strSQL & " "&WL(LK3)&""					
				Else	'文科学生
					strSQL = strSQL & " "&WL(WK3)&""					
				End If 
			End If 
		End If 
	End If 
	'response.write strsql
	KMPM = oConn.Execute(strSQL)(0) + 1
End Function 

'//---总成绩排名---
'//参数:考试ID,排名类别:(1,班级,2,年级),班级名称,总成绩
Function ZCJPM(ksID,PM,BJ,FS)
	Dim strSQL
	strSQL = "Select Count(总成绩) As pm From sumCJ,sTable Where sTable.sID=sumCJ.sID And sumCJ.ksID="&ksID&" And sumCJ.总成绩>"&FS&""
	If PM = 1 Then
		strSQL = strSQL & " And sTable.班级='"&BJ&"'"
	ElseIf PM = 2 Then
		'//加入文理科班级名次
		If Left(BJ,2)=(Right((CInt(Year(Date))+3),2)) Then '如果为一年级就不分文理班
			strSQL = strSQL & " And sTable.年级='"&Left(BJ,2)&"'"
		Else 
			'//判断是二年级或三年级
			If Left(BJ,2)=(Right("00"&(CInt(Year(Date))+2),2)) Then '二年级学生
				If InStr(LK2,BJ)>0 Then '理科班级
					strSQL = strSQL & " "&WL(LK2)&""
				Else	'文科学生
					strSQL = strSQL & " "&WL(WK2)&""
				End If 
			Else	'三年级学生
				If InStr(LK3,BJ)>0 Then '理科班级
					strSQL = strSQL & " "&WL(LK3)&""
				Else	'文科学生
					strSQL = strSQL & " "&WL(WK3)&""
				End If 
			End If 
		End If
	End If 
	'response.write strsql
	ZCJPM = oConn.Execute(strSQL)(0) + 1
End Function 

Function WL(strBJ)
	Dim tmpSQL,tmpArray,i
	tmpSQL = " And ("
	tmpArray = Split(strBJ,",")
	For i = 0 To UBound(tmpArray)
		If i >0 Then tmpSQL = tmpSQL & " or "
		tmpSQL = tmpSQL & "sTable.班级='"&tmpArray(i)&"'"
	Next
	tmpSQL = tmpSQL & ")"
	WL = tmpSQL
End Function 

Function sKS()
	Dim strSqL,tmpHtml,objRs
	tmpHtml = "<select name=""ksID"">"
	tmpHtml = tmpHtml & "<option value="""">考试项目</option>"
	strSQL = "Select ksID,考试名称 from ksName order by ksID desc"
	Set objRs = oConn.Execute(strSQL)
	If Not objRs.Eof Then
		Do While Not objRs.Eof
			tmpHtml = tmpHtml & "<option value="""&objRs(0)&""""
			tmpHtml = tmpHtml & ">"&objRs(1)&"</option>"
			objRs.MoveNext
			If objRs.Eof Then Exit Do
		Loop
	End If
	Set objRs = Nothing
	tmpHtml = tmpHtml & "</select>"

	sKS = tmpHtml
End Function
Function sKM()
	Dim strSqL,tmpHtml,objRs
	tmpHtml = "<select name=""kmID"">"
	tmpHtml = tmpHtml & "<option value="""">选择科目</option>"
	strSQL = "Select kmID,科目名称 from kmName order by kmID desc"
	Set objRs = oConn.Execute(strSQL)
	If Not objRs.Eof Then
		Do While Not objRs.Eof
			tmpHtml = tmpHtml & "<option value="""&objRs(0)&""""
			tmpHtml = tmpHtml & ">"&objRs(1)&"</option>"
			objRs.MoveNext
			If objRs.Eof Then Exit Do
		Loop
	End If
	Set objRs = Nothing
	tmpHtml = tmpHtml & "</select>"

	sKM = tmpHtml
End Function

Function selectKS(ksID)
	Dim strSqL,tmpHtml,objRs
	tmpHtml = "<select name=""ksID"">"
	strSQL = "Select ksID,考试名称 from ksName order by ksID desc"
	Set objRs = oConn.Execute(strSQL)
	If Not objRs.Eof Then
		Do While Not objRs.Eof
			tmpHtml = tmpHtml & "<option value="""&objRs(0)&""""
			If objRs(0) = CInt(ksID) Then tmpHtml = tmpHtml & " selected"
			tmpHtml = tmpHtml & ">"&objRs(1)&"</option>"
			objRs.MoveNext
			If objRs.Eof Then Exit Do
		Loop
	End If
	Set objRs = Nothing
	tmpHtml = tmpHtml & "</select>"

	selectKS = tmpHtml
End Function
Function selectKM(kmID)
	Dim strSqL,tmpHtml,objRs
	tmpHtml = "<select name=""kmID"">"
	strSQL = "Select kmID,科目名称 from kmName order by kmID desc"
	Set objRs = oConn.Execute(strSQL)
	If Not objRs.Eof Then
		Do While Not objRs.Eof
			tmpHtml = tmpHtml & "<option value="""&objRs(0)&""""
			If objRs(0) = CInt(kmID) Then tmpHtml = tmpHtml & " selected"
			tmpHtml = tmpHtml & ">"&objRs(1)&"</option>"
			objRs.MoveNext
			If objRs.Eof Then Exit Do
		Loop
	End If
	Set objRs = Nothing
	tmpHtml = tmpHtml & "</select>"

	selectKM = tmpHtml
End Function

Function SearchFrom(tmpT)
	Dim tmpHtml
	tmpHtml = "<table align=""center"" width=""100%"">"
	tmpHtml = tmpHtml & "<form method=""get"" name=""Search"" onsubmit=""return checkS()"">"
	tmpHtml = tmpHtml & "<tr><td class=""thetitle"">"&tmpT&"</td>"
	tmpHtml = tmpHtml & "<td align=""right"">"
	tmpHtml = tmpHtml & "<select name=""sc"">"
	tmpHtml = tmpHtml & "	<option value=""学号"">学号</option>"
	tmpHtml = tmpHtml & "	<option value=""编码"">编码</option>"
	tmpHtml = tmpHtml & "	<option value=""姓名"">姓名</option>"
	tmpHtml = tmpHtml & "	<option value=""班级"">班级</option>"
	tmpHtml = tmpHtml & "	<option value=""年级"">年级</option>"
	tmpHtml = tmpHtml & "</select> "
	tmpHtml = tmpHtml & "<input type=""text"" size=""10"" name=""sk"" id=""sk""> "
	tmpHtml = tmpHtml & "<input type=""submit"" value=""查 询""> "
	If RQuery("sk")&""<>"" Then tmpHtml = tmpHtml & "<input type='button' value='显示所有' onclick=""location.href='?'"">"
	tmpHtml = tmpHtml & "</td>"
	tmpHtml = tmpHtml & "</tr>"
	tmpHtml = tmpHtml & "</form>"
	tmpHtml = tmpHtml & "</table>"

	SearchFrom = tmpHtml
End Function

'-------------------------------------------
'删除指定文件(参数:文件相对路径)
'-------------------------------------------
Sub FileDel(FilePath)
	On Error Resume Next
		DelFilePath = Server.MapPath(FilePath)
		Set Fso = Server.CreateObject("Scripting.FileSystemObject")
		If Fso.FileExists(DelFilePath) Then
			Fso.DeleteFile DelFilePath,true
		End if
		Set Fso=nothing
	If Err Then
		Err.Clear
	End If
End Sub

'//更新总成绩,参数:考试ID,学生ID
Sub UPSumCJ(kID,sID)
	Dim objRs,strSQL,zCJ,pCJ,objRs1
	strSQL = "Select sum(分数) as zf,avg(分数) as pjf from cjTable Where sID="&sID&" And ksID="&kID&""
	Set objRs = oConn.Execute(strSQL)
	If Not objRs.Eof then
		zCJ = objRs(0)
		pCJ = objRs(1)

		strSQL = "Select 总成绩,平均成绩 from sumCJ Where sID="&sID&" And ksID="&kID&""
		Set objRs1 = Server.CreateObject("adodb.recordset")
		objRs1.Open strSQL,oConn,2,3
		If Not objRs1.Eof Then
			objRs1(0).value = zCJ
			objRs1(1).value = pCJ
			objRs1.Update
		Else
			objRs1.AddNow
			objRs1(0).value = zCJ
			objRs1(1).value = pCJ
			objRs1.Update
		End If
		objRs1.Close
		Set objRs1 = Nothing
	Else
		oConn.Execute("delete from sumCJ Where sID="&sID&" And ksID="&kID&"")
	End If 
	Set objRs = Nothing
End Sub 

'//取得科目名称列表
Function getKM()
	Dim objrs,tmpKM
	Set objrs = oConn.Execute("select 科目名称 from kmName order by kmID asc")
	tmpKM = ""
	If Not objrs.eof Then
		Do While Not objrs.eof
			tmpKM = tmpKM & "," & objrs(0)
			objrs.movenext
			If objrs.eof Then Exit Do
		Loop
	Else
		tmpKM = tmpKM & ",<span style=""color:blue"">请先录入科目名称</span>"
	End If
	Set objrs = Nothing
	
	getKM = tmpKM
End Function 
%>

⌨️ 快捷键说明

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