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

📄

📁 我做的第一个学生管理系统
💻
📖 第 1 页 / 共 2 页
字号:
	course_sql = "select 学号,姓名,名次,"
	total_score ="("
	select_course = 0
	
		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)+"+"
			select_course = select_course + 1	
		
		next
		
		
		
	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 "
	
	course_sql = course_sql +" where 学号 in (select 学号 from student where rtrim(班号)='"+rtrim(classno)+"') and "
			     
	course_sql = course_sql + " 学年='"+yearno.value+"' and 学期='"+termno.value+"' and 成绩类型='总评成绩'" 

	
	rds2.SQL = course_sql + " order by "+total_score + " DESC"
	rds2.ExecuteOptions = 1
	rds2.refresh
	if rds2.Recordset.recordcount = 0 then
		
		exit sub
	end if
	scoreFillOrder()
	
    xlApp.Visible = true
 
	ToPrintExcel(classno)
   ' xlApp.Visible = false

end sub

'==============================================================
sub toPrintExcel(classno)
   print_lineno = print_lineno +3  
   xlSheet.Cells(print_lineno,courseSelectCount/2) = rtrim(classno)+"班"+yearno.value+"年"+termno.value+"学期成绩表"

   print_lineno=print_lineno+2
   for k=0 to rds2.Recordset.fields.count-1 
	   
     xlsheet.cells(print_lineno,k+1)=rds2.Recordset.fields(k).name
     
    next 
   
	print_lineno = print_lineno + 1
    rds2.Recordset.movefirst
    
    while not rds2.Recordset.eof


     For j = 0 To  rds2.Recordset.fields.count-1 

  

      If isnull(rds2.Recordset.fields(j))=false  then   ' or trim(rds1.Recordset.fields(j))<>"" then
    
      
         if IsNumeric(rds2.Recordset.fields(j)) = true  Then
    
                   xlSheet.Cells(print_lineno, j + 1) = trim(cstr(rds2.Recordset.fields(j)))
               
         else        

          xlSheet.Cells(print_lineno, j + 1) = trim(cstr(rds2.Recordset.fields(j)))

       End If
 
    
    
    end if   

    Next
   
    print_lineno=print_lineno+1
    rds2.Recordset.movenext
    
 wend 
end sub

'========按班、年级及学号取某学年某学期所开所的课程======
sub get_course(classno,get_type)
	courseSelectCount = 0
	
	select case get_type 
		case "CLASS"
			rds2.SQL = " select 课程号 from class_course where 班号='"+classno+"' and "&_
						" 学年='"+yearno.value+"' and 学期='"+termno.value+"'"	
		case "XH"
			rds2.SQL = "select a.课程号 from class_course as a,student 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 class_course  where 班号 in (select 班号 from 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 scoreFillOrder() '成绩排序,填写名次
	loopcount = rds2.Recordset.recordcount
	
	rds2.recordset.Movefirst
	
	for i = 0 to loopcount-1 
		rds2.recordset.fields(2).value = cstr(i+1)
		rds2.Recordset.movenext
	next
	rds2.recordset.Movefirst 	

end sub
	

'===============================================

sub returning()
    history.go(-1)

end sub
'==============================================================


</script>

</html>

⌨️ 快捷键说明

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