当前位置:文档之家› 班级成绩管理系统

班级成绩管理系统

2010-2011第一学期数据库期末考试试卷请在90分钟内按要求独立完成具有如下界面及功能的“班级成绩管理系统”图1 图2操作说明:1、在D盘根目录下创建具有如下格式的文件夹:年级专业班级姓名,例如:09计1潘明宇、09计32刘伟。

所有表单以菜单项目名为文件名,登录表单文件名为“登录”,主表单为“班级成绩管理系统”,菜单名为“班级成绩管理系统”,所有表单的标题必须替换为相应功能的中文名。

2、创建名为”班级成绩表.dbf”的数据表文件,学号以“01”、“02”方式录入,至少5条记录。

字段为:3、由登录窗口(图1)跳转到主界面(图2),主界面所含菜单如图,除文件菜单不具功能外,其余菜单项均具相应的菜单功能。

用户名为考生中文名字,密码为考生姓名的全拼。

4、功能说明:(1)追加,即为记录添加,以屏幕变量替换字段方式进行,不准直接操作数据表数据。

(2)修改,具有翻动记录并修改记录的功能。

(3)插入,以定位记录号的方式在指导定记录号之前插入记录,不准直接操作数据表,以屏幕变量替换字段方式进行。

(4)具有物理删除指定记录号记录内容的功能。

(5)显示,为浏览方式显示。

(6)查询,除评语外,可指定其他字段为查询字段,然后指定字段值查询,查询结果在新窗口中显示。

(7)排序,除评语外,可指定其他字段为排序字段,统一按降序排列。

(8)统计,具有自动计算平均分、总分、各科最高分、最低分、及格人数等。

(9)退出,退出系统。

5、评分说明:见附表班级成绩管理系统界面及代码说明:图1登录表单*登录按钮代码:if thisform.text1.text="杜小林" and thisform.text2.text="duxiaolin"thisform.releasedo form d:\ 班级成绩管理系统\班级成绩管理系统endif*取消按钮代码:thisform.release图2班级成绩表表结构图3主界面表单*Form1的init过程代码:Do d:\ 班级成绩管理系统\班级成绩管理系统.mpr with thisform,.t.图4追加表单界面*所有表单界面属性四修改:1、caption(标题)2、height(高度)3、width(宽度)4、showwindow(显示方式)*form1 的load过程代码:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2)*追加按钮代码:if len(alltrim(thisform.txt学号.value))>0append blankrepl 学号with thisform.txt学号.valuerepl 语文with val(alltrim(thisform.txt语文.value))repl 数学with val(alltrim(thisform.txt数学.value))repl 英语with val(alltrim(thisform.txt英语.value))repl 计算机with val(alltrim(thisform.txt计算机.value))repl 平均分with val(alltrim(thisform.txt平均分.value))repl 总分with val(alltrim(thisform.txt总分.value))repl 名次with thisform.txt名次.valuerepl 评语with thisform.edt评语.value***清除屏幕显示thisform.txt学号.value=""thisform.txt语文.value=""thisform.txt数学.value=""thisform.txt英语.value=""thisform.txt计算机.value=""thisform.txt平均分.value=""thisform.txt总分.value=""thisform.txt名次.value=""thisform.edt评语.value=""@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshelse@0,2 say "不能追加空记录!" colo 4/2=inkey(5)@0,2 say " "endif图5插入表单界面*Form1的load过程代码:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2)*文本框lostfocus代码if val(alltrim(thisform.text1.text))>0mand1.enabled=.t.endif*插入按钮代码:if len(alltrim(thisform.txt学号.value))>0go val(alltrim(thisform.text1.text))&&定位insert blank before&&之前插入空记录repl 学号with thisform.txt学号.valuerepl 语文with val(alltrim(thisform.txt语文.value))repl 数学with val(alltrim(thisform.txt数学.value))repl 英语with val(alltrim(thisform.txt英语.value))repl 计算机with val(alltrim(thisform.txt计算机.value))repl 平均分with val(alltrim(thisform.txt平均分.value))repl 总分with val(alltrim(thisform.txt总分.value))repl 名次with thisform.txt名次.valuerepl 评语with thisform.edt评语.value***清除屏幕显示thisform.txt学号.value=""thisform.txt语文.value=""thisform.txt数学.value=""thisform.txt英语.value=""thisform.txt计算机.value=""thisform.txt平均分.value=""thisform.txt总分.value=""thisform.txt名次.value=""thisform.edt评语.value=""mand1.enabled=.f.&&修改插入按钮状态thisform.text1.value=""&&清除记录号输入@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshelse@0,2 say "不能插入空记录!" colo 4/2=inkey(5)@0,2 say " "mand1.enabled=.f.&&修改插入按钮状态thisform.text1.value=""&&清除记录号输入endif图6修改表单界面*数据环境关联数据表*上一条if .not.bof()skip -1@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshendif*下一条if .not.eof()skip@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshendif*第一条go top@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refresh*最后一条go bottom@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refresh*取消thisform.release图7删除表单界面*Form1的load过程:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) *Form1的init过程:if deleted()thisform.check1.value=1elsethisform.check1.value=0endif*上一条if .not.bof()skip -1if deleted()thisform.check1.value=1elsethisform.check1.value=0endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshendif*下一条if .not.eof()skipif deleted()thisform.check1.value=1elsethisform.check1.value=0endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refreshendif*第一条go topif deleted()thisform.check1.value=1elsethisform.check1.value=0endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refresh*最后一条go bottomif deleted()thisform.check1.value=1elsethisform.check1.value=0endif@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) thisform.refresh*取消thisform.release*复选框代码:if thisform.check1.value=1deleteelserecallendif*删除按钮代码:Pack@0,50 say “当前是第”+str(recno(),2)+”条记录”+space(5)+”总记录数为:”+str(reccount(),2) Thisform.refresh图8排序表单界面*Form1的load过程代码:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif*排序按钮代码:s1=thisform.optiongroup1.value&&获取第一单选组的选值s2=thisform.optiongroup2.value&&获取第二单选组的选值if s2=2ps="desc"&&根据选项值给变量赋值endifzd=field(s1)&&必须赋值给变量,再通过宏代换使用if s2=1sele * from e:\班级成绩管理系统\班级成绩表order by &zd&&升序排序elsesele * from e:\班级成绩管理系统\班级成绩表order by &zd &ps&&降序排序endif图9查询表单界面*Form1的load过程代码:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif*查询按钮代码:*符号赋值do casecase thisform.optiongroup2.value=1fh=">"case thisform.optiongroup2.value=2fh="<"case thisform.optiongroup2.value=3fh=">="case thisform.optiongroup2.value=4fh="<="case thisform.optiongroup2.value=5fh="="case thisform.optiongroup2.value=6fh="<>"endcasezd=field(thisform.optiongroup1.value)&&获取选中的字段if thisform.optiongroup1.value=1.or.thisform.optiongroup1.value=8ml="sele * from e:\班级成绩管理系统\班级成绩表where &zd"+fh+"alltrim(thisform.text1.text)"&mlelseml="sele * from e:\班级成绩管理系统\班级成绩表where &zd"+fh+"val(alltrim(thisform.text1.text))"&mlendif图10统计表单界面*Form1的load过程代码:If used(“班级成绩表”)Sele 班级成绩表elseuse e:\班级成绩管理系统\班级成绩表endif*统计按钮代码:*符号赋值do casecase thisform.optiongroup2.value=1fh=">"case thisform.optiongroup2.value=2fh="<"case thisform.optiongroup2.value=3fh=">="case thisform.optiongroup2.value=4fh="<="case thisform.optiongroup2.value=5fh="="case thisform.optiongroup2.value=6fh="<>"xz=thisform.optiongroup1.value+1zd=field(xz,1)&&获取选中的字段***统计内容赋值tj=""if thisform.check1.value=1tj=tj+"count(&zd) as &zd.个数"endifif thisform.check2.value=1if len(tj)>0tj=tj+",avg(&zd) as &zd.平均"elsetj=tj+"avg(&zd) as &zd.平均"endifendifif thisform.check3.value=1if len(tj)>0tj=tj+",sum(&zd) as &zd.求和"elsetj=tj+"sum(&zd) as &zd.求和"endifendifif thisform.check4.value=1if len(tj)>0tj=tj+",max(&zd) as &zd.最大值"elsetj=tj+"max(&zd) as &zd.最大值"endifendifif thisform.check5.value=1if len(tj)>0tj=tj+",min(&zd) as &zd.最小值"elsetj=tj+"min(&zd) as &zd.最小值"endifendif****组合查询命令字符串ml="sele "+tj+" from e:\班级成绩管理系统\班级成绩表where &zd"+fh+"val(alltrim(thisform.text1.text))"&ml&&执行查询命令**关闭查询表if used("查询")sele 查询use*取消按钮Thisform.release*退出菜单代码:quit。

相关主题