数据库课程设计--学生成绩管理系统.doc_第1页
数据库课程设计--学生成绩管理系统.doc_第2页
数据库课程设计--学生成绩管理系统.doc_第3页
数据库课程设计--学生成绩管理系统.doc_第4页
数据库课程设计--学生成绩管理系统.doc_第5页
免费预览已结束,剩余10页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

课程设计说明书题目: 学生信息管理系统 院 系: 信息工程与科学学院 专业班级: 09专四 学 号: 学生姓名: 指导教师: 2011年 6 月 25 日摘要 学校学生管理信息系统是针对学校人事处的大量业务处理工作而开发的管理软件,是典型的管理信息系统(management information system)。它是一个教育单位不可缺少的部分,它的内容对于学校的决策者和管理者来说都至关重要,它能够为用户提供充足的信息和快捷的查询手段。能有效的帮助学校和老师掌握学生的情况,为学生提供成绩跟课程方面的查询。目录摘要-1目录-2一概述-3二主要功能-3三需求分析-3四概念模型设计-5五逻辑和物理结构设计-6六 数据库的实施与维护-8七总结-13一 概述1.1目的与要求随着科技的发展,基本上所有的具有一定数量数据的机构都开始使用计算机数据库来做管理。几乎所有学校也都已经在使用计算机管理数据的机制,大大减少了学校学生成绩管理的工作量。该课程设计要求设计一个学生成绩的数据库管理系统,数据库中要求包含学生的基本信息,学科基本信息,以及学生所学课程的考试成绩。要方便学生进行成绩查询,通过该课程设计,应该达到把数据库理论知识更加的巩固加深,加强动手能力与实践能力,学以致用,与现实生活中的应用充分的结合起来。二 主要功能1学籍信息管理2班级信息管理3课程信息管理4成绩信息管理5系统管理三 需求分析系统功能要求设计此系统实现如下系统功能:(1)使得学生的成绩管理工作更加清晰、条理化、自动化。(2)通过用户名和密码登录系统,查询课程基本资料,学生所选课程成绩,修改用户密码等功能。 容易地完成学生信息的查询操作。(3) 设计人机友好界面,功能安排合理,操作使用方便,并且进一步考虑系统在安全性,完整性,并发控制,备份和恢复等方面的功能要求。 系统模块设计登陆失败学生管理课程管理退出系统用户验证成绩查询登陆成功成绩管理系统大体可以分成二大模块如, 一是学生的基本信息模块,里面应该包含学生的各方面的基本信息;再者便是课程管理模块, 在该模块中应该包含有对学生成绩信息的查询和处理,如平均成绩、最好成绩、最差成绩以及不及格学生的统计等功能模块;再其次还有教师、课程等相关信息的模块;可以得到系统流程图: 数据字典 数据项是数据库的关系中不可再分的数据单位,下表分别列出了数据的名称、数据类型、长度、取值能否为空。利用sql server 2000建立“学生选课”数据库,其基本表清单及表结构描述如下:数据库中用到的表:数据库表名关系模式名称备注student学生学生学籍信息表course课程课程基本信息表score成绩选课成绩信息表student基本情况数据表,结构如下:字段名字段类型not null说明student _snocharprimary key学号student _sncharnot null学生姓名student _sexchar男或女性别student _deptchar系别student_agechar年龄student_addresschar地址course数据表,结构如下:字段名字段类型约束控制说明course_cnochar主键(primary key)课程号course_cnamecharnot null课程名称course_hourintnot null课时course_scorenumeric(2,1)not null学分score情况数据表,结构如下:字段名字段类型约束控制说明score_idintnot null成绩记录号course_cnochar外部键课程号student_snochar外部键学号scoreint成绩四 概念模型设计由需求分析的结果可知,本系统设计的实体包括:(1)学生基本信息:学号,姓名,性别,地址,年龄,专业。(2)课程基本信息: 课程名,课程号,分数,学时,学分。 这些实体间的联系包括:(1)每位学生可以学习多门课程,每门课程可供多位学生学习。由上述分析可得到系统的er图:选修课程成绩学生课程号课程名学时 学分分数学号姓名性别系别 地址年龄五逻辑和物理结构设计由系统er图转化而得到的关系模式如下:(1)学生(学号,姓名,性别,年龄,地址,系别),其主关键字为学号;(2)课程(课程名,课程号,学时,学分),其中主关键字为课程号;(3)成绩(课程号,学号,分数)其中主关键字为学号和课程号。可以与学生关系模式合并为:学生(学号,姓名,性别,年龄,地址,系别,成绩,课程号)。 确定关系模型的存取方法在将概念模型转换成物理模型之后,我们可以对物理模型进行设计,双击物理模型的关系,可以对该关系的名称、注释等信息进行查询。可对该关系的属性列进行设计,可分别设置其名称、码、数据类型以及主码、是否为空等。在实际设计中最常用的存取方法是索引发,使用索引可以大大减少数据的查询时间,在建立索引时应遵循:在经常需要搜索的列上建立索引; 在主关键字上建立索引;在经常用于连接的列上建立索引,即在外键上建立索引;在经常需要根据范围进行搜索的列上创建索引,因为索引已经排序,其指定的范围是连续的等规则。才能充分利用索引的作用避免因索引引起的负面作用。 确定数据库的存储结构确定数据库的存储结构主要指确定数据的存放位置和存储结构,包括确定关系、索引、日志、备份等的存储安排及存储结构,以及确定系统存储参数的配置。因为该成绩管理系统的数据量小,所以我们只用把数据存储在使用的电脑硬盘上,不用作更多的安排。(1)创建学生基本信息表:create table student ( 学号 varchar(11) not null, 系别 varchar(5) not null, 姓名 varchar(6) not null, 性别 varchar(2) not null, 年龄 char(2) not null, 地址 varchar(20) not null, constraint pk_student primary key (学号)goexecute sp_addextendedproperty ms_description, 学生基本信息描述, user, , table, studentsinfogo(2)创建课程表:create table course ( cno varchar(5) not null, cname varchar(10) null, xueshi smallint null, xuefen int null, constraint pk_course primary key (课程号)goexecute sp_addextendedproperty ms_description, (3)创建学生与课程的成绩表create table sc ( sno varchar(11) not null,cno varchar(5) not null,chengji varchar(4) not null constraint pk_sc primary key (学号, 课程号)go在sc表上创建索引sc_fk与sc2_fkcreate index sc_fk on sc (学号 asc)gocreate index sc2_fk on sc (课程号 asc)go 建立课程号索引create index tc_fk on tc (课程号 asc)go下图显示了学生,课程和成绩三个关系的物理设计其中课程号与学号号分别为关系的主码。 六 数据库的实施与维护数据库的实施:此阶段主要任务包括创建数据库,加载初始数据,数据库试运行,数据库的安全性和完整性控制数据库的备份与恢复,数据库性能的监督分析和改仅,数据库的重组和重构等。首先在数据库中建立一个学生成绩管理系统数据库,然后新建一个数据源。主要代码如下:begin combobox1.items.append(adoquery1.fieldvalues系名); /combobox1连到系表的 系名 字段 adoquery1.next;end; end;procedure tform11.combobox1select(sender: tobject);beginadoquery2.close;adoquery2.sql.clear;adoquery2.sql.add(select * from class where 系名=+combobox1.text+);/查询系名是否符合adoquery2.execsql;adoquery2.open;while not adoquery2.eof do begin combobox2.items.append(adoquery2.fieldvalues班级);/符合就调用班级表的字段 班级 adoquery2.next;end;end; procedure tform11.combobox2select(sender: tobject);beginadoquery4.close;adoquery4.sql.clear;adoquery4.sql.add(select * from kecheng where 班级=+combobox2.text+);/查询课程表中字段 班级 是否符合,符合就调到adoquery4.execsql; /dbgiid1adoquery4.open;end; procedure tform11.combobox3select(sender: tobject);beginadoquery4.close;adoquery4.sql.clear;adoquery4.sql.add(select * from kecheng where 班级=+combobox2.text+ and 学期=+combobox3.text+); /判断学期是否符合adoquery4.execsql;adoquery4.open;end; procedure tform11.speedbutton1click(sender: tobject);beginwhile not adoquery4.eof dobeginif (adoquery4.fieldvalues课程号=adoquery3.fieldvalues课程号) and (adoquery4.fieldvalues班级=combobox2.text) and (adoquery4.fieldvalues学期=combobox3.text) thenbreak;adoquery4.next;end;if adoquery4.eof thenbeginadoquery4.insert; /把选课内容添加到选课表中。 adoquery4.fieldvalues课程号:=adoquery3.fieldvalues课程号;adoquery4.fieldvalues班级:=combobox2.text;adoquery4.fieldvalues课程名:=adoquery3.fieldvalues课程名;adoquery4.fieldvalues学期:=combobox3.text;adoquery4.post;endelsebeginshowmessage(本课程此班级已经选过); /如果已经选过,弹出对话框“本课程此班级已经选过”end;end;procedure tform11.speedbutton2click(sender: tobject);beginif not adoquery4.eof thenadoquery4.delete;end;end. 课程管理:procedure tform9.formcreate(sender: tobject);beginadoquery3.close; /关闭数据库adoquery3.sql.clear; /清空adoquery3.sql.add(select * from kechengbiao);adoquery3.execsql;adoquery3.open;dbedit1.datafield:=课程号;dbedit2.datafield:=课程名;dbedit3.datafield:=课时;dbedit4.datafield:=学分;/dbcombobox1.datafield:=学期;dbcombobox2.datafield:=类型; end; procedure tform9.speedbutton1click(sender: tobject);beginif speedbutton1.caption=添加 thenbeginadoquery3.insert; /添加到课程表speedbutton1.caption:=确定;speedbutton4.enabled:=true;speedbutton2.enabled:=false;speedbutton3.enabled:=false;endelseif speedbutton1.caption=确定 thenbeginif dbedit1.text= thenbeginshowmessage(请输入课程号!); /如果课程号没输入,弹出对话框endelsebeginadoquery3.post;speedbutton1.caption:=添加;speedbutton4.enabled:=false;speedbutton2.enabled:=true;speedbutton3.enabled:=true;end;end;end; procedure tform9.speedbutton2click(sender: tobject);beginif adoquery3.eof thenbeginspeedbutton2.enabled:=false;speedbutton3.enabled:=false;end;if speedbutton2.caption=删除 thenbeginspeedbutton2.caption:=确定;speedbutton4.enabled:=true;speedbutton1.enabled:=false;speedbutton3.enabled:=false;endelsebeginadoquery3.delete; /从数据表中删掉所选记录speedbutton2.caption:=删除;speedbutton4.enabled:=false;speedbutton1.enabled:=true;speedbutton3.enabled:=true;end;end; procedure tform9.speedbutton4click(sender: tobject);begin adoquery3.cancel;speedbutton1.caption:=添加;speedbutton2.caption:=删除;speedbutton3.caption:=修改;speedbutton4.enabled:=false;speedbutton1.enabled:=true;speedbutton2.enabled:=true;speedbutton3.enabled:=true;end; procedure tform9.speedbutton3click(sender: tobject);beginif speedbutton3.caption=修改 thenbeginadoquery3.edit; /修改课程表中的记录speedbutton3.caption:=确定;speedbutton4.enabled:=true;speedbutton2.enabled:=false;speedbutton1.enabled:=false;endelsebeginadoquery3.post;speedbutton3.caption:=修改;speedbutton4.enabled:=false;speedbutton2.enabled:=true;speedbutton1.enabled:=true;end; end; procedure tform9.label1dblclick(sender: tobject);beginform11:=tform11.create(application);form11.showmodal; end;end. 课程查询部分:procedure tform4.combobox1select(sender: tobject); beginedit1.text:=;button1.enabled:=false;end; procedure tform4.button1click(sender: tobject);beginif checkbox1.checked=true thenbeginadoquery1.close; /先将数据库关闭adoquery1.sql.clear; /清空adoquery1内的sql值清空adoquery1.sql.add(select * from kecheng where +combobox1.text+ = +edit1.text+ and 学期 = +combobox2.text+); /合并查询,符合的话在dbgrid中显示出来adoquery1.execsql;adoquery1.open;endelsebeginadoquery1.close;adoquery1.sql.clear;adoquery1.sql.add(select * from kecheng where +combobox1.text+ = +edit1.text+);/单个条件查询adoquery1.execsql;adoquery1.open;end;end; procedure tform4.n2click(sender: tobject);begin /开启其他管理界面form2.show;form4.close;end; procedure tform4.n3click(sender: tobject);begin form3.show;form4.close;end; procedure tform4.n4click(sender: tobject);beginform5.show;form4.close;end; procedure tform4.n6click(sender: tobject);beginform1.show;form4.close;end; procedure tform4.n7click(sender: tobject);b

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论