📄
字号:
if class_radio.checked then
call score_search("CLASS")
end if
end sub
'====================根据班号,学号,年级查询成绩====================================
sub score_search(search_type)
'========================================================================
'根据课程名,取得课程代码
course_sql = "select 学号,姓名,"
total_score ="("
select_course = 0
if rtrim(courseno.value)="所有课程" then
for i = 0 to courseCount - 1
'找出本学期开设了哪些课程,通过计算总分是否为零进行判断
rds2.SQL = "select sum("+courseNoArray(0,i)+") from score "
if search_type="CLASS" then
rds2.SQL = rds2.SQL +" where 学号 in (select 学号 from student where rtrim(班号)='"+rtrim(classno.value)+"') and "
end if
if search_type="GRADE" then
rds2.SQL = rds2.SQL +" where 学号 in (select 学号 from student where 班号 in (select 班号 from class where year(入学年度)='"+rtrim(gradeno.value)+"')) and "
end if
if search_type="XH" then
rds2.SQL = rds2.SQL +" where rtrim(学号) >= rtrim("+startno.value+") and rtrim(学号) <= rtrim("+endno.value+") and "
end if
rds2.SQL = rds2.SQL + " 学年='"+yearno.value+"' and 学期='"+termno.value+"' and 成绩类型='"+scoreno.value+"'"
'msgbox rds2.sql
rds2.ExecuteOptions=1
rds2.Refresh
sum_array = rds2.Recordset.GetRows(1,0,0)
if sum_array(0,0) > "0" then '表明此课程已有成绩
course_sql = course_sql +"'"+rtrim(courseArray(0,i))+"'=str("+courseNoArray(0,i)+",7,1),"
total_score = total_score + courseNoArray(0,i)+"+"
select_course = select_course + 1
end if
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
'找出本学期是否开设了此课程,通过计算总分是否为零进行判断
rds2.SQL = "select sum("+courseNoArray(0,i)+") from score "
if search_type="CLASS" then
rds2.SQL = rds2.SQL +" where 学号 in (select 学号 from student where rtrim(班号)='"+rtrim(classno.value)+"') and "
end if
if search_type="GRADE" then
rds2.SQL = rds2.SQL +" where 学号 in (select 学号 from student where 班号 in (select 班号 from class where year(入学年度)='"+rtrim(gradeno.value)+"')) and "
end if
if search_type="XH" then
rds2.SQL = rds2.SQL +" where rtrim(学号) >= rtrim("+startno.value+") and rtrim(学号) <= rtrim("+endno.value+") and "
end if
rds2.SQL = rds2.SQL + " 学年='"+yearno.value+"' and 学期='"+termno.value+"' and 成绩类型='"+scoreno.value+"'"
rds2.ExecuteOptions=1
rds2.Refresh
sum_array = rds2.Recordset.GetRows(1,0,0)
if sum_array(0,0) >"0" 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 "
if search_type="CLASS" then
course_sql = course_sql +" where 学号 in (select 学号 from student where rtrim(班号)='"+rtrim(classno.value)+"') and "
end if
if search_type="GRADE" then
course_sql = course_sql +" where 学号 in (select 学号 from student where 班号 in (select 班号 from 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+"'"
'msgbox course_sql
rds1.SQL = course_sql
rds1.ExecuteOptions = 1
rds1.refresh
if rds1.Recordset.recordcount = 0 then
msgbox "对不起,成绩还没有输入无法查询!"
exit sub
end if
end sub
'===============================================
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
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
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>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -