数据库课程设计文档模板(完整版)_第1页
数据库课程设计文档模板(完整版)_第2页
数据库课程设计文档模板(完整版)_第3页
数据库课程设计文档模板(完整版)_第4页
数据库课程设计文档模板(完整版)_第5页
免费预览已结束,剩余28页可下载查看

下载本文档

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

文档简介

1 数数 据据 库库 课课 程程 设设 计计 题 目 学生学籍管理系统 院 系 专 业 网络工程专业 班 级 学 号 姓 名 指导老师 2012 年 12 月 20 日 2 计算机系课程设计任务书计算机系课程设计任务书 课程名称 课程名称 数据库原理及应用课程设计题目课程设计题目学生学籍管理系统 学学 号 号 姓名 姓名 指导老师 指导老师 专业班级 专业班级 设计时间 设计时间 设计设计 目的目的 学生学籍管理系统被广泛应用于各类学校的学生学籍管理工作中 要求其具 有实用性强 使用方便 效率高和安全可靠等特点 本管理系统正是围绕以上几 个方面进行开发的 在开发过程中充分考虑到本系统的应用特点 并进行了大量 的检验 证明其的确达到了设计的要求 是一个已具备了实际应用能力的软件 本文主要论述学生学籍管理系统的开发过程 在涉及到 C 及 SQL 中的部分知识 以举例的方式进行讲解 实施实施 阶段阶段 1 建立学生档案 设计学生入学 管理及查询界面 2 设计学生各学期 学年成绩输入及查询界面 并打印各项报表 3 根据各年度总成绩 查询 输出学生学籍管理方案 优秀 合格 试读 退学 4 毕业管理 5 系统维护 3 教师教师 评语评语 备注备注 目录目录 1 需求分析 4 1 1 用户需求 4 1 2 系统功能的设计和划分 4 1 3 数据字典 5 1 3 1 数据项 5 1 3 2 数据结构 7 2 概念结构设计 7 2 1 数据流图 7 2 2 系统 E R 图 8 3 逻辑结构设计 9 3 1 关系模型 9 4 软件设计 10 4 1 物理结构设计 10 4 1 1 数据库物理设计的内容和方法 10 4 1 2 关系模式存取方法选择 10 4 1 3 数据的存放位置 10 4 1 4 评价物理结构 11 4 2 功能实现 11 4 3 sql 11 5 编码实现 代码和界面 14 5 1 登陆界面 14 5 2 主界面 5 3 查询界面 24 5 4 学生入学界面 26 5 5 学生信息界面 6 心得体会 33 4 课程设计报告课程设计报告 1 1 需求分析 需求分析 1 1 用户需求 本系统是针对高等院校的学生学籍管理 因此学籍管理系统的用户包括系统 管理员 教师和学生 主要涉及系部信息 班级信息 任课教师信息 学生信息 课程信息以及选课记录和成绩等多种数据信息 实现的具体功能如下 学生基本信息管理 系统管理员负责对各种基本信息的录入 修改 删除等操作 课程信息管理 学生对所选课程的查询操作 教师信息管理 系统管理员负责对教师各种基本信息的录入 修改 删除等操作 教师可以查看自己的基本信息 老师教学管理 查询老师所上课程以及上课地点 学生选课管理 查询学生所选课程以及所选课程的分数 1 2 系统功能的设计和划分 根据系统功能的需求分析和高等院校学籍管理的特点 经过模块化的分析得 到如下图 1 1 所示的系统功能模块结构图 5 学籍管理系统 学 生 学 籍 管 理 毕 业 学 生 管 理 成 绩 管 信 息 理 课 程 信 息 管 理 基 本 信 息 删 除 基 本 信 息 修 改 基 本 信 息 录 入 基 本 信 息 修 改 基 本 信 息 录 入 基 本 信 息 删 除 基 本 信 息 修 改 学 生 学 籍 删 除 基 本 信 息 删 除 户 图 1 1 系统功能模块图 1 3 数据字典 1 3 1 数据项 数据字典是系统中各类数据描述的集合 是进行详细的数据收集和数据分析 所获得的主要成果 数据字典是对系统所用到的所有表结构的描述 学籍管理的 主要数据见下表 Student 表如下 表 1 2 学生基本信息表 序号字段别名数据类型数据长度码 1SNo学号Varchar50Y 2Sname姓名Varchar50N 3SAge年龄Int4N 4SGender性别Nchar2N 基 本 信 息 录 入 6 Adress地址NChar50N telephone电话Char20N 5SDepartmentId课程号Int8N 6SEnterYear入学时间Varchar10N Course 表如下 表 1 3 课程表 序号字段别名数据类型数据长度码 1Cno课程号Varchar50Y 2Cname课程名nVarchar50N 3CTime学分Varchar50N 4CXQ教师号Varchar50N Department 表如下 表 1 4 教师信息表 序号字段别名数据类型数据长度码 1DepartmentId专业号Int4Y 2Department专业名nvarchar50N Student course 表如下 表 1 6 学生选课表 序号字段别名数据类型数据长度码 1Sno学号Varchar20 2Cno课程号Varchar20Y W 3Score成绩Varchar20N user 教课 表 1 7 用户表 序号字段别名数据类型数据长度码 1UserName用户名Varchar20Y 2PassWord密码Varchar20N 7 1 3 2 数据结构 数据结构反映了数据之间的组合关系 一个数据结构可以由若干个数据项组 成 也可以由若干个数据结构组成 或若干个数据项和数据结构混合组成 经过 数据项和用户需求的分析 对本系统一共分了 5 个组 具体如下表所示 表 1 9 数据结构表 数据结构名含义说明组成部分 学生信息管理描述学生基本信息学号 姓名 性别 出生日 期 入学时间 课程信息管理描述课程基本信息课程号 课程名 教师号 成绩信息管理描述学生成绩信息课程号 课程名 姓名 成 绩 学分 毕业学生管理描述毕业学生基本信息学号 姓名 性别 2 2 概念结构设计 概念结构设计 概念结构设计是整个数据库设计的关键 它通过对用户需求进行综合 归纳 与抽象 形成独立于具体 DBMS 的概念模型 2 1 数据流图 数据流图表达了数据和处理的关系 根据用户的需求分析和高校学籍管理系 统的需求 得出如下图 2 1 所示的学籍管理数据流图 图 2 1 学籍管理系统数据流图 8 2 2 系统系统 E R 图图 1 对于学生信息管理 我们可以将学生实体抽象出来 如图 2 2 所示 2 课程实体 E R 图 3 专业 E R 图 专业 专业号专业名 4 课程成绩 E R 图 学生 学号 姓名性别 入学 时间 地址 课程 课程号课程名课程学期课程学年 电话年龄课程号 9 课程成绩 课程号学号成绩 3 3 逻辑结构设计 逻辑结构设计 逻辑结构设计就是把概念结构设计阶段设计好的基本 E R 图转换为与选用 DBMS 产品所支持的数据模型相符合的逻辑结构 设计逻辑结构一般分为 3 步进行 1 将概念结构转换为一般的关系 网状 层次模型 2 将转换来的关系 网状 层次模型向特定 DBMS 支持下的数据模型转 换 3 对数据模型进行优化 3 1 关系模型 将概念结构设计阶段设计好的基本 E R 图转换为关系模型 如下所示 1 学生 学号 姓名 性别 出生年月 系别 入学年份 课程号 2 课程 课程号 课程名 课程学期 课程学年 3 专业 专业号 专业名 4 成绩 课程号 学生号 成绩 10 4 4 软件设计 软件设计 4 1 物理结构设计 4 1 1 数据库物理设计的内容和方法 不同的数据库产品所提供的物理环境 存取方法和存储结构有很大差别 能 供设计人员使用的设计变量 参数范围也很不相同 因此没有通用的物理设计方 法可遵循 只能给出一般的设计内容和原则 希望设计优化的物理数据库结构 使得在数据库上运行的各种事务响应时间小 存储空间利用率高 事务吞吐率大 为此 首先对要运行的事务进行的各种事务获得选择物理数据库设计所需要的参 数 其次 要充分了解所用 RDBMS 的内部特征 特别是系统提供的存取方法和 存储结构 4 1 2 关系模式存取方法选择 该设计选用了唯一索引跟非唯一索引 由于考虑到要经常对学生信息表 选 课表 教师表和课程表进行查询 而学生信息表的学号必须唯一 因此为它建立 唯一索引 其它表就建立非唯一索引以提高查询效率 脚本如下 create unique index sno on student Sno create index sno on student course Sno create index cno on course cno 4 1 3 数据的存放位置 为了提高系统性能 数据库设计可根据用户需求将数据的易变部分与稳定部 分 经常存取部分和存取频率低部分分开存放 以加快存取速度 这在多用户环 境下特别有效 还可以将日志文件与数据库对象 表 索引等 放在不同的磁盘 上 以改进系统的性能 11 4 1 4 评价物理结构 根据对数据库的权衡 对经常查询的表创建索引能大大提高时间效率 对基 本表进行规范化 减少数据冗余以及存储空间的占用 对数据库创建触发器 数 据的增删改都能自动地进行同步 减少维护的负担 根据不同用户的需求 数据 库还可以更改数据存放位置 实现更合理的方案 4 2 功能实现 完成数据库的物理设计之后 设计人员就要用 RDBMS 提供的数据定义语言 和其他实用程序将数据库逻辑设计和物理设计结果严格描述出来 成为 DBMS 可以接受的源代码 再经过调试产生目标模式 然后就可以组织数据入库 最后 就在此基础上编写各个表相关的触发器和存储过程 4 3 SQL 界面 4 3 1abo course 表 4 3 2abo Department 表 12 4 3 dbo student 4 4 dbo student course 13 4 5 SysUser 14 5 5 编码实现 代码和界面 编码实现 代码和界面 5 1 登陆界面 代码 代码 using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms using System Data SqlClient using System IO using System Xml using System Collections using StudentManager DbLayer 15 namespace StudentManager public partial class FormLogin Form public FormLogin InitializeComponent public static bool isValidate false 登录 按钮单击事件 private void buttonLogin Click object sender EventArgs e 1 构造查询语句 形如 select from SysUser where UserName 张三 and Password 123456 string sql sql select from SysUser where UserName sql SqlStringConstructor GetQuotedString this textBoxUserName Text sql and Password sql SqlStringConstructor GetQuotedString this textBoxPwd Text 2 查询数据 Database db new Database DataRow row db GetDataRow sql 3 根据查询结果 判断用户是否合法 if row null FormLogin isValidate true FormMain this MdiParent ChangeMenuStatus this Close else MessageBox Show 对不起 您输入的用户名或者密码错误 16 窗口加载 事件 private void FormLogin Load object sender EventArgs e this Height 380 从文件 Database config 中 读取数据库配置参数 XmlDocument xdc new XmlDocument try 读取XML文档格式的Database config文件中 连接字符串数据 xdc Load Database config string conString xdc ChildNodes 1 ChildNodes 0 Attributes value Value ArrayList arr new ArrayList arr AddRange conString Split catch 退出 按钮单击事件 private void buttonExit Click object sender EventArgs e this Close 配置 按钮单击事件 private void buttonConfig Click object sender EventArgs e 17 if this buttonConfig Text 服务器配置 this textBoxUserName Focus this buttonConfig Text 服务器配置 this Height 380 else this textBoxServer Focus this buttonConfig Text 服务器配置 this Height 544 配置确定 单击按钮 private void buttonConfigOk Click object sender EventArgs e 将用户输入的配置参数 保存到当前目录下 Database config 文件中 StreamWriter writer new StreamWriter Database config false System Text Encoding Default writer WriteLine writer WriteLine string conStr writer WriteLine conStr writer WriteLine writer Close Database db new Database db Open 18 this buttonConfig Text 服务器配置 this Height 380 配置重置 单击按钮 private void buttonConfigReset Click object sender EventArgs e 把各项内容清空 this textBoxServer Text this textBoxDbName Text this textBoxDbUser Text this textBoxDbPwd Text this textBoxServer Focus 19 5 2 主界面 代码 代码 using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms namespace StudentManager public partial class FormMain Form public FormMain InitializeComponent 20 窗体加载事件 private void FormMain Load object sender EventArgs e 1 弹出登录窗口 FormLogin f new FormLogin 得到一个登录窗口对象 f MdiParent this 使登录窗口成为主窗口的子窗口 f Show 弹出登录窗口 2 使菜单项实效 this menuStripMain Enabled false 退出 菜单项单击事件 private void 退出ToolStripMenuItem Click object sender EventArgs e this Close 登录 菜单项单击事件 private void toolStripMenuItem2 Click object sender EventArgs e FormLogin f new FormLogin f MdiParent this f Show 入学 菜单项单击事件 21 private void 入学ToolStripMenuItem Click object sender EventArgs e FormStudentAdd f new FormStudentAdd f MdiParent this f Show 更改菜单的状态 public void ChangeMenuStatus if FormLogin isValidate this menuStripMain Enabled true else this menuStripMain Enabled false 修改 菜单项单击事件 private void toolStripMenuItem1 Click object sender EventArgs e FormStudentUpdate f new FormStudentUpdate f MdiParent this f Show 毕业 菜单项单击事件 private void 毕业ToolStripMenuItem Click object sender EventArgs e FormStudentDelete f new FormStudentDelete f MdiParent this f Show 22 查询 菜单项单击事件 private void 查询ToolStripMenuItem Click object sender EventArgs e FormStudentSearch f new FormStudentSearch f MdiParent this f Show 课程录入 菜单项单击事件 private void 课程录入ToolStripMenuItem Click object sender EventArgs e FormCourseAdd f new FormCourseAdd f MdiParent this f Show 成绩查询 菜单项单击事件 private void 成绩查询SToolStripMenuItem Click object sender EventArgs e FormScoreSearch f new FormScoreSearch f MdiParent this f Show 成绩录入 菜单项单击事件 private void 成绩录入ToolStripMenuItem Click object sender EventArgs e FormScoreImport f new FormScoreImport 23 f MdiParent this f Show private void 入学ToolStripMenuItem1 Click object sender EventArgs e FormStudentAdd f new FormStudentAdd f MdiParent this f Show private void 查询ToolStripMenuItem1 Click object sender EventArgs e FormStudentSearch f new FormStudentSearch f MdiParent this f Show private void 修改ToolStripMenuItem Click object sender EventArgs e FormStudentUpdate f new FormStudentUpdate f MdiParent this f Show private void 毕业ToolStripMenuItem1 Click object sender EventArgs e FormStudentDelete f new FormStudentDelete f MdiParent this f Show private void 课程输入ToolStripMenuItem Click object sender EventArgs e FormCourseAdd f new FormCourseAdd f MdiParent this f Show private void 成绩输入ToolStripMenuItem Click object sender EventArgs e FormScoreImport f new FormScoreImport f MdiParent this 24 f Show private void 成绩查询ToolStripMenuItem Click object sender EventArgs e FormScoreSearch f new FormScoreSearch f MdiParent this f Show private void 退出ToolStripMenuItem Click 1 object sender EventArgs e this Close private void 姓名查询ToolStripMenuItem Click object sender EventArgs e cjcx f new cjcx f MdiParent this f Show 5 3 查询界面 代码 代码 private void dataGridViewPreView CellContentClick object sender 25 DataGridViewCellEventArgs e private void button1 Click object sender EventArgs e string strcon Data Source A07 SQL2005 Initial Catalog StudentManager Integrated Security true SqlConnection conn new SqlConnection strcon conn Open string str null if checkBox1 Checked true str select CName Score SName CTime CXQ from Student Course Student Course where Student Course SNo Student SNo and Student Course CNo Course CNo and Student SName textBox1 Text Trim if checkBox3 Checked true str select CName Score SName CTime CXQ from Student Course Student Course where Student Course SNo Student SNo and Student Course CNo Course CNo and Student SName textBox1 Text Trim and Course CTime textBox2 Text Trim if checkBox2 Checked true str select CName Score SName CTime CXQ from Student Course Student Course where Student Course SNo Student SNo and Student Course CNo Course CNo and Student SName textBox1 Text Trim and Course CXQ textBox3 Text Trim if checkBox2 Checked true str select CName Score SName CTime CXQ from Student Course Student Course where Student Course SNo Student SNo and Student Course CNo Course CNo and Student SName textBox1 Text Trim and Course CXQ textBox3 Text Trim 26 5 4 学生入学界面 代码 代码 private void buttonAdd Click object sender EventArgs e 用户输入检查 if textBoxSNo Text MessageBox Show 学号不能为空 return if textBoxSName Text MessageBox Show 姓名不能为空 return string sql Database db new Database 27 int departmentId 0 从Department表中 检索DepartmentId sql select DepartmentId from Department where DepartmentName sql SqlStringConstructor GetQuotedString comboBoxDepartment SelectedItem ToString DataRow row db GetDataRow sql departmentId GetSafeData ValidateDataRow N row DepartmentId 构造Insert语句 sql sql insert into student SNo SName SAge SGender SDepartmentId SEnterYear Adress telephone values sql SqlStringConstructor GetQuotedString textBoxSNo Text 学号 sql SqlStringConstructor GetQuotedString textBoxSName Text 姓名 sql SqlStringConstructor GetQuotedString textBoxSAge Text 年龄 性别 if radioButtonMale Checked sql SqlStringConstructor GetQuotedString radioButtonMale Text else sql SqlStringConstructor GetQuotedString radioButtonFemale Text sql departmentId 院系 sql SqlStringConstructor GetQuotedString comboBoxEnterYear SelectedItem ToString 入学年 份 sql SqlStringConstructor GetQuotedString textBoxAdress Text 地址 sql SqlStringConstructor GetQuotedString textBoxPhone Text 联系电话 db ExecuteSQL sql this ResetInput MessageBox Show 修改成功 5 45 4 学生信息界面学生信息界面 28 代码 代码 public partial class FormStudentSearch Form public FormStudentSearch InitializeComponent InitData 初始化窗体中控件的数据 void InitData 查询数据表Department中的院系数据 并绑定到 院系 下拉框中 构造查询SQL string sql sql select from Department 29 查询 Database db new Database SqlDataReader dr db GetDataReader sql 绑定到下拉框中 comboBoxDepartment Items Clear while dr Read comboBoxDepartment Items Add GetSafeData ValidateDataReader S dr DepartmentName if comboBoxDepartment Items Count 0 comboBoxDepartment SelectedIndex 0 入学年份 下拉框数据 comboBoxEnterYear SelectedIndex 0 性别 按钮 radioButtonMale Checked true 窗体加载事件 private void splitContainer1 Panel1 Paint object sender PaintEventArgs e InitData 查询数据 并绑定到DataGridView中 void Query Database db new Database string sql bool hasCond false sql select SNo SName SAge SGender DepartmentName SEnterYear Adress telephone from Student Department 30 学号 if textBoxSNo Text if hasCond sql where hasCond true else sql and sql SNo SqlStringConstructor GetQuotedString textBoxSNo Text 姓名 if textBoxSName Text if hasCond sql where hasCond true else sql and sql SName SqlStringConstructor GetQuotedString textBoxSName Text 年龄 if textBoxSAge Text if hasCond sql where hasCond true else sql and 31 sql SAge textBoxSAge Text 性别 if radioButtonAll Che

温馨提示

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

评论

0/150

提交评论