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

📄

📁 我做的第一个学生管理系统
💻
字号:

<%
CategoryID=Request("CategoryID")
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>毕业生成绩查询管理模块 write by longZhiping on 1999.8.26</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">

</head>

<body background="../../images/di2001.jpg">

<p>
<object id="rds1" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0">
</object>
<object id="rds2" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0">
</object>

<div align="center"><center>
<table border="1" width="770" height="325">
    <TR>
    <td width="610" height="325" valign="top" align="center">
    <OBJECT classid="clsid:00028CD1-0000-0000-0000-000000000046"
    codeBase="http://210.0.0.210/school/public/tdbg6.ocx"
    dataSrc=#rds1 height=367 id=grid1 style="HEIGHT: 367px; LEFT: 0px; TOP: 0px; WIDTH: 600px" 
	width=600 VIEWASTEXT></OBJECT>
    </td>
  
    <td width="150" height="325" valign="top">
            <P><font color="#ff0000">请选择查询范围:</font><br>
            <font color="#0000ff">班号</font><select name="classno" size="1" ></select><br>
            
	
	<P><font color="#0000ff">&nbsp;&nbsp;学年<INPUT id=yearno name=yearno 
            style="FONT-FAMILY: serif; HEIGHT: 21px; LEFT: 18px; TOP: 65px; WIDTH: 61px"></font><br>
    <font color="#0000ff">&nbsp;&nbsp;学期</font><select name="termno" size="1">
      <option selected value="上">上学期
      <option value="下">下学期
    </select><br><font color="#0000ff">&nbsp;&nbsp;课程</font><select name="courseno" size="1" >
		<option selected value="所有课程">所有课程    
     </select><br><font color="#0000ff">&nbsp;&nbsp;成绩</font><select name="scoreno" size="1" >
      <option value="期中成绩">期中成绩
      <option value="期末成绩">期末成绩
      <option value="平时成绩">平时成绩
      <option value="补考成绩">补考成绩
      <option selected value="总评成绩">总评成绩
    </select></P>
         
     </P><br><br>
            <P align="center"><input type="button" value="查    询" onclick="beginSearch()" name="start_input" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px"  ></p> 
			<P align="center"><input type="button" value="学号排序" onclick="xhSort()" name="start_input" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px"  ></p>
			<P align="center"><input type="button" value="成绩排序" onclick="scoreSort()" name="start_input" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px"  ></p> 
            <P align="center"><input type="button" value="退    出" onclick="returning()" name="exiting" style="COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 14px"  > 
 
    </p></td></TR>

</table>
</center></div>
<script language="Vbscript">
	dim courseNoArray,courseArray,courseSelectArray,xhOrderArray
	dim courseCount,courseSelectCount
	dim course_sql
	dim total_score

	
	rds1.server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
	rds1.connect ="database=school;uid=sa;pwd=;dsn=school"

	rds2.server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
	rds2.connect ="database=school;uid=sa;pwd=;dsn=school"

'Get all class Number 
	rds2.sql = "select * from graduate_class where Left(班号,2)=Right(rtrim(<%=CategoryID%>),2)"
	rds2.ExecuteOptions = 1
	rds2.refresh
	classArray = rds2.recordset.Getrows(rds2.recordset.recordcount,0,0)
	
	
	for i=0 to rds2.recordset.recordcount-1 
		  set oOption = document.createElement("OPTION")
		  oOption.text  = classArray(0,i)
	      oOption.value = classArray(0,i)
	      document.all.classno.add(oOption)		
	next

'下面从数据库中取得课程名称,课程代码
	rds2.sql = "select * from course"
	rds2.ExecuteOptions = 1
	rds2.refresh
	courseArray = rds2.recordset.Getrows(rds2.recordset.recordcount,0,1)
	rds2.Recordset.movefirst
	courseNoArray= rds2.recordset.Getrows(rds2.recordset.recordcount,0,0) 
	courseCount = rds2.Recordset.recordcount 
	rds2.Recordset.movefirst
	courseSelectArray= rds2.recordset.Getrows(rds2.recordset.recordcount,0,0) 
	courseSelectCount = 0
	
	for i=0 to rds2.recordset.recordcount-1 
		  set oOption = document.createElement("OPTION")
		  oOption.text  = courseArray(0,i)
	      oOption.value = courseArray(0,i)
	      document.all.courseno.add(oOption)		
	next
        grid1.caption="毕 业 生 成 绩 查 询 管 理"
        grid1.captionstyle.forecolor="0,0,0,250"
        Grid1.CaptionStyle.Font.Size = "15"
</script>


</body>

<script language="VBScript">
'==============================================================
sub beginSearch()
	
	'if class_radio.checked then
		if len(trim(classno.value))=0 then
			msgbox "对不起!请先输入要查询的班号!"
			exit sub
		end if
	'end if
	
	'if grade_radio.checked then
	'	if len(trim(gradeno.value))=0 then
	'		msgbox "对不起!请先输入要查询的年级!"
	'		exit sub
	'	end if
	'end if
	
	'if xh_radio.checked then
	'	if len(trim(startno.value))=0 then
	'		msgbox "对不起!请先输入要查询的学号!"
	'		exit sub
	'	end if
	'end if
	
		
	if len(trim(yearno.value))=0 then
		msgbox "对不起!请先输入要查询的学年!"
		exit sub
	end if
	
	'if xh_radio.checked then
	'if len(rtrim(startno.value)) > 0 then
	'	if len(rtrim(endno.value)) > 0 then
	'		if rtrim(endno.value) < rtrim(startno.value) then
	'			msgbox "终止学号必须不小于起始学号!"
	'			exit sub
	'		end if
	'	else
	'		endno.value = startno.value
	'	end if
	'end if
	'end if 
	
	'if xh_radio.checked then
	'		call score_search("XH")
	'end if 
	
	'if grade_radio.checked then
	'		call score_search("GRADE")
	'end if 
	
	'if class_radio.checked then
			call score_search("CLASS")
	'end if


end sub 
			
'====================根据班号,学号,年级查询成绩====================================
sub score_search(search_type)    
'========================================================================	
	'根据课程名,取得课程代码
	 get_course(search_type)
	 if CourseSelectCount<=0 then
		msgbox("没有输入此学期成绩!请输入成绩或到班级课程设置模块中运行刷新功能")
		exit sub
	 end if
	
	course_sql = "select 学号,姓名,名次,"
	total_score ="("
	select_course = CourseSelectCount
	if rtrim(courseno.value)="所有课程" then
		for i = 0 to courseSelectCount - 1
 			course_sql = course_sql +"'"+rtrim(GetCourseName(i))+"'=str("+courseSelectArray(0,i)+",7,1),"
 	
			total_score = total_score + courseSelectArray(0,i)+"+"
		next
		
    else
			
		for i = 0 to CourseCount -1
			if rtrim(courseArray(0,i)) = rtrim(courseno.value) then
				course_sql = course_sql +"'"+rtrim(courseArray(0,i))+"'=str("+courseNoArray(0,i)+",7,1),"
				total_score = total_score + courseNoArray(0,i)+"+"
				
				exit for
			end if
		next  
		'找出本学期是否开设了此课程,通过计算是否在开设数组中CourseSelectArrary中进行判断
		findOpned = false
		for j = 0 to CourseSelectCount-1
			if courseNoArray(0,i)=CourseSelectArray(0,j) then
	
				findOpend = true
				exit for
			end if
		next
		if findOpend then		
			select_course = 1	
		else
			 '表明此课程没有成绩
				msgbox "没有输入成绩,请选择其它课程!"
				exit sub
		end if 
		
	end if 
	if select_course=0 then
		msgbox "没有输入成绩,请选择其它课程或成绩类型!"
		exit sub
	end if
	
	
	total_score = total_score + "0)"
	avg_score = total_score+"/"+cstr(select_course) 
	course_sql = course_sql + "'总成绩'=str("+total_score+",6,1),'平均成绩'=str("+avg_score+",6,2)   from score<%=CategoryID%> "
		if search_type="CLASS" then
				course_sql = course_sql +" where 学号 in (select 学号 from student<%=CategoryID%> where rtrim(班号)='"+rtrim(classno.value)+"') and "
			end if 
		if search_type="GRADE" then
				course_sql = course_sql +" where 学号 in (select 学号 from student<%=CategoryID%> where 班号 in (select 班号 from graduate_class where year(入学年度)='"+rtrim(gradeno.value)+"')) and "
			end if
		if search_type="XH" then
				course_sql = course_sql +" where rtrim(学号) >= rtrim("+startno.value+") and rtrim(学号) <= rtrim("+endno.value+") and "
			end if
		
			     
		course_sql = course_sql + " 学年='"+yearno.value+"' and 学期='"+termno.value+"' and 成绩类型='"+scoreno.value+"'"
	
	rds1.SQL = course_sql
	rds1.ExecuteOptions = 1
	rds1.refresh
	
		
	if rds1.Recordset.recordcount = 0 then
		msgbox "对不起,成绩还没有输入无法查询!"
    	exit sub
	end if
	scoreSort()
	xhOrderArray = rds1.recordset.Getrows(rds1.recordset.recordcount,0,0) 
	xhsort()
	
end sub

'========按班、年级及学号取某学年某学期所开所的课程======
sub get_course(get_type)
	courseSelectCount = 0
	
	select case get_type 
		case "CLASS"
			rds2.SQL = " select 课程号 from graduate_class_course where 班号='"+classno.value+"' and "&_
						" 学年='"+yearno.value+"' and 学期='"+termno.value+"'"	
		case "XH"
			rds2.SQL = "select a.课程号 from graduate_class_course as a,student<%=CategoryID%> as b where b.学号>='"+rtrim(startno.value)+"' and "&_
					   " b.学号<='"+rtrim(endno.value)+"' and b.班号=a.班号 and "&_
					   " 学年='"+yearno.value+"' and 学期='"+termno.value+"' group by a.课程号"
			
		case "GRADE" 
			rds2.SQL = " select 课程号 from graduate_class_course  where 班号 in (select 班号 from graduate_class where year(入学年度)='"+rtrim(gradeno.value)+"') and "&_ 
						" 学年='"+yearno.value+"' and 学期='"+termno.value+"' group by 课程号"
		
	end select
	'msgbox rds2.sql
	rds2.ExecuteOptions = 1
	rds2.Refresh
	courseSelectCount = rds2.Recordset.recordcount
	if courseSelectCount <=0 then
		exit sub 
	end if 
	
	courseSelectArray= rds2.recordset.Getrows(rds2.recordset.recordcount,0,0) 
	
end sub
				
'==============根据序列号从开设课程数组中取课程名称=================
function  GetCourseName(cno)
	GetCourseName = "No Find"
	for loopcount = 0 to courseCount-1
		if courseNoArray(0,loopcount) = courseSelectArray(0,cno) then
			GetCourseName = courseArray(0,loopcount)
			exit for
		end if
	next
end function
	

'===============================================
sub xhSort()
	if len(trim(rds1.SQL)) <=0 then
		msgbox "没有查询结果,无法进行排序!"
		exit sub
	end if
	
	rds1.SQL = course_sql + " order by 学号"
	'msgbox rds1.sql
	rds1.ExecuteOptions=1
	rds1.refresh
	
	 xhFillOrder()
	
end sub
'==============================================================

'===============================================
sub scoreSort()
   if len(trim(rds1.SQL)) <=0 then
	msgbox "没有查询结果,无法进行排序!"
		exit sub
	end if
	
	rds1.SQL = course_sql + " order by "+total_score + " DESC"
	rds1.ExecuteOptions=1
	rds1.refresh
	
	scoreFillOrder()
	
	
end sub
'==============================================================
sub scoreFillOrder() '成绩排序,填写名次
	loopcount = rds1.Recordset.recordcount
	
	rds1.recordset.Movefirst
	
	for i = 0 to loopcount-1 
		rds1.recordset.fields(2).value = cstr(i+1)
		rds1.Recordset.movenext
	next
	rds1.recordset.Movefirst 	

end sub

sub xhFillOrder() '学号排序,填写名次
	
	loopcount = rds1.Recordset.recordcount
	rds1.recordset.Movefirst	
	for i = 0 to loopcount-1
		for j = 0 to loopcount - 1
			if rds1.Recordset.fields(0).value = xhOrderArray(0,j) then
					rds1.recordset.fields(2).value = cstr(j+1)
					exit for
			end if
		next 
		rds1.Recordset.movenext
	next

end sub





sub returning()
    history.go(-1)

end sub
'==============================================================
sub grid1_BeforeColEdit(colindex,keyascii,cancel)
		msgbox "不输入和修改成绩!"			
		cancel = true	
end sub

</script>
<SCRIPT language=javascript>
function click() {
if (event.button==2) {
alert('对不起,禁止使用此功能^_^.')
}
}
document.onmousedown=click
</SCRIPT>
</table>
</center></div>
</html>

⌨️ 快捷键说明

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