1、数据库课程设计之学生信息管理系统一、引言1课程实验目的课程设计为学生提供了一个既动手又动脑,独立实践的机会,将课本上的理论知识和实际有机的结合起来,锻炼学生的分析解决实际问题的能力。提高学生适应实际,实践编程的能力。课程设计的目的:加深对数据库系统、软件工程、程序设计语言的理论知识的理解和应用水平;在理论和实验教学基础上进一步巩固已学基本理论及应用知识并加以综合提高;学会将知识应用于实际的方法,提高分析和解决问题的能力,增强动手能力;为毕业设计和以后工作打下必要基础。2课程实验题目:设计一个大学教学数据库应用。该系统涉及学生、教师、课程、分组、登记、数据。3课程设计要求:运用数据库基本理论与应
2、用知识,在微机RDBMS(SQL Server)的环境上建立一个数据库应用系统。要求把现实世界的事物及事物之间的复杂关系抽象为信息世界的实体及实体之间联系的信息模型,再转换为机器世界的数据模型和数据文件,并对数据文件实施检索、更新和控制等操作。1.用E-R图设计指定题目的信息模型;2.设计相应的关系模型,确定数据库结构;3.分析关系模式各属于第几范式,阐明理由;4.设计应用系统的系统结构图,确定系统功能;5.使用对象许可和命令许可、角色控制设计安全性控制检查程序;6.通过设计关系的主码约束、外码约束和使用CHECK、RULE实现完整性控制;7.为每一参照关系设计插入、删除、修改触发器;8.实现
3、应用程序设计、编程、优化功能;9.对系统的各个应用程序进行集成和调试,进一步优化系统功能、改善系统用户界面完成实验内容所指定的各项要求;10.分析遇到的问题,总结并写出课程设计报告;11.自我评价二、用E-R图设计选定题目的信息模型 学生实体的E-R图 教师实体E-R图 课程实体E-R图 分组实体E-R图 教师任课实体E-R图 三、设计相应的关系模型,确定数据库结构* STUDENTS(student,student_name,address,zip,city,state,sex)* TEACHERS(teacher,teacher_name,phone,salary)* COURSES(co
4、urse,course_name,department,nurc_credits)* SECTION(section,teacher,course,num_students)* ENROLLS(course,section,student,grade)分析关系模式各属于第几范式,阐明理由;STUDENTS 属于BCNF,因为其中的每个决定因素都包含了码TEACHERS 属于BCNF,因为其中的每个决定因素都包含了码COURSES 属于BCNF,因为其中的每个决定因素都包含了码ENROLLS 属于BCNF,因为其中的每个决定因素都包含了码SECTION 属于BCNF, 因为其中的每个决定因素都包
5、含了码 设计关系的主码约束、外码约束和使用CHECK实现完整性控制; STUDENTS信息基本表 create table STUDENTS( student char(8) primary key, student_name char(20), address char(20), zip char(10), city char(20), state char(8), sex char(2); TEACHERS基本表 create table TEACHERS( teacher char(8) primary key, teacher_name char(10), phone char(10)
6、, salary char(8); COURSES基本表 create table COURSES( course char(8) primary key, course_name char(20), department char(20), nurc_credits char(4); SECTION表 create table SECTION( section char(4), teacher char(8) primary key, course char(8), num_students char(4), foreign key (course) references COURSES(c
7、ourse); ENROLLS表 create table ENROLLS( course char(8), section char(4), student char(8), grade SMALLINT, primary key(course,section,student), foreign key (course) references COURSES(course), foreign key (student) references STUDENTS(student); 为参照关系设计插入、删除、修改触发器;实现应用程序设计、编程、优化功能;对系统的各个应用程序进行集成和调试,进一步
8、优化系统功能、改善系统用户界面完成实验内容所指定的各项要求;四、源程序代码清单using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication2 public partial class F
9、orm1 : Form public Form1() InitializeComponent(); private void 学生ToolStripMenuItem_Click(object sender, EventArgs e) string connectionStr = Data Source=qinjia-PC;Initial Catalog=sjk;Integrated Security=True; SqlConnection conn = new SqlConnection(connectionStr); conn.Open(); SqlDataAdapter sdr1 = ne
10、w SqlDataAdapter(select* from STUDENTS, conn); DataSet ds1 = new DataSet(); sdr1.Fill(ds1, STUDENTS); dataGridView1.DataSource = ds1.Tables0; conn.Close(); /学生基本信息 private void 教师ToolStripMenuItem_Click(object sender, EventArgs e) string connectionStr = Data Source=qinjia-PC;Initial Catalog=sjk;Inte
11、grated Security=True; SqlConnection conn = new SqlConnection(connectionStr); conn.Open(); SqlDataAdapter sdr1 = new SqlDataAdapter(select* from TEACHERS, conn); DataSet ds1 = new DataSet(); sdr1.Fill(ds1, TEACHERS); dataGridView1.DataSource = ds1.Tables0; conn.Close(); /教师基本信息 private void 课程ToolStr
12、ipMenuItem_Click(object sender, EventArgs e) string connectionStr = Data Source=qinjia-PC;Initial Catalog=sjk;Integrated Security=True; SqlConnection conn = new SqlConnection(connectionStr); conn.Open(); SqlDataAdapter sdr1 = new SqlDataAdapter(select* from COURSES, conn); DataSet ds1 = new DataSet(
13、); sdr1.Fill(ds1, COURSES); dataGridView1.DataSource = ds1.Tables0; conn.Close(); /课程基本信息 private void 分组ToolStripMenuItem_Click(object sender, EventArgs e) string connectionStr = Data Source=qinjia-PC;Initial Catalog=sjk;Integrated Security=True; SqlConnection conn = new SqlConnection(connectionStr
14、); conn.Open(); SqlDataAdapter sdr1 = new SqlDataAdapter(select* from SECTION, conn); DataSet ds1 = new DataSet(); sdr1.Fill(ds1, SECTION); dataGridView1.DataSource = ds1.Tables0; conn.Close(); /分组基本信息 private void 登记ToolStripMenuItem_Click(object sender, EventArgs e) string connectionStr = Data Sou
15、rce=qinjia-PC;Initial Catalog=sjk;Integrated Security=True; SqlConnection conn = new SqlConnection(connectionStr); conn.Open(); SqlDataAdapter sdr1 = new SqlDataAdapter(select* from ENROLLS, conn); DataSet ds1 = new DataSet(); sdr1.Fill(ds1, ENROLLS); dataGridView1.DataSource = ds1.Tables0; conn.Close(); /登记基本信息 private void 查询1 ToolStripMenuItem_Click(obj
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1