课程设计报告
( 20##--20##年度第2学期)
名 称:数据库原理课程设计
题 目:图书信息管理系统
院 系 : 计算机系
班 级: 软件1302
学 号: 201309020208
学生姓名: 李兆辉
指导教师: 阎蕾
设计周数: 1
成 绩:
日期:20##年 7月 17日
《数据库原理课程设计》课程设计
任 务 书
一、 目的与要求
1. 本实验是为信息安全等专业的学生在学习数据库原理后,为培养更好的解决问题和实际动手能力而设置的实践环节。通过这个环节,使学生具备应用数据库原理对数据库系统进行设计的能力。为后继课程和毕业设计打下良好基础。
2. 通过该实验,培养学生在建立数据库系统过程中使用关系数据理论的能力。
3. 通过对一个数据库系统的设计,培养学生对数据库需求分析、数据库方案设计、系统编码、界面设计和软件调试等各方面的能力。是一门考查学生数据库原理、面向对象设计方法、软件工程和信息系统分析与设计等课程的综合实验。
二、 主要内容
针对一个具有实际应用场景的中小型系统(见题目附录)进行数据库设计,重点分析系统涉及的实体、实体之间的联系,实现增加、删除、更新、查询数据记录等基本操作。大致分为如下步骤:
1. 理解系统的数据库需求,分析实体及实体间联系,画出E-R图:
1. 分析确定实体的属性和码,完成对该实体的实体完整性、用户自定义完整性的定义。
2. 设计实体之间的联系,包括联系类型和联系的属性。最后画出完整的E-R图。
2.根据设计好的E-R图及关系数据库理论知识设计数据库模式:
1) 把E-R图转换为逻辑模式;
2) 规范化设计。使用关系范式理论证明所设计的关系至少属于3NF并写出证明过程;如果不属于3NF则进行模式分解,直到该关系满足3NF为止,要求写出分解过程。
3) 设计关系模式间的参照完整性,要求实现级联删除和级联更新。
4) 用SQL语言完成数据库内模式的设计。
3.数据库权限的设计:
1) 根据系统分析,完成授权操作;
2) 了解学习收回权限的操作。
4.完成用户界面的设计,对重要数据进行加密。
5.连接数据库,用宿主语言实现系统所需的各种操作:
1) 实现数据记录的录入、删除、查询和修改。
2) 以视图的形式完成复杂查询,比如多表、多条件等。
三、进度计划
四、设计(实验)成果要求
1. 在DBMS(如oracle,SQL Server 20##/2008,DB2等)上完成完整的数据库的设计;
2. 使用可视化开发平台完成信息系统,要求可以正确运行;
3. 完成实验报告。
五、考核方式
1. 在微机上检查数据库模式的设计、三大完整性的设计、关系属于几范式等;
2. 在微机上检查系统的运行结果,要求学生阐述使用的相关技术;
3. 实验报告的检查。
六、 题目附录
1. 学生信息管理信息系统
2. 图书管理信息系统
3. 物资管理信息系统
4. 汽车销售管理信息系统
5. 超市管理信息系统
6. 通讯录管理信息系统
7. 工资管理信息系统
8. 酒店管理信息系统
9. 小区物业管理信息系统
10. 学生成绩管理系统
学生姓名:李兆辉
指导教师:阎蕾
20##年 7 月 17 日
一、课程设计(综合实验)的目的与要求
1. 本实验是为计算机科学与技术等专业的学生在学习数据库原理后,为培养更好的解决问题和实际动手能力而设置的实践环节。通过这个环节,使学生具备应用数据库原理对数据库系统进行设计的能力。为后继课程和毕业设计打下良好基础。
2. 通过该实验,培养学生在建立数据库系统过程中使用关系数据理论的能力。
3. 通过对一个数据库系统的设计,培养学生对数据库需求分析、数据库方案设计、系统编码、界面设计和软件调试等各方面的能力。是一门考查学生数据库原理、面向对象设计方法、软件工程和信息系统分析与设计等课程的综合实验。
二、设计(实验)正文
1、 系统功描述
实现对书籍编号、分类、查询、借阅等功能
2.部分结果展示
3实验总结
本次实验基本达到了实验目的。此次实验,在之前学习的管理系统上自己加上数据库。在搭建数据库时,加深了对理论知识的理解。对概念设计的步骤掌握的更加清晰,对分析过程中的原则有了更清晰的认识,使得对数据库系统的整体设计有了更深层次的理解和掌握。总体上学会了最基本的数据库连接,但仍然需要继续学习提高水平。
4. 部分代码
namespace BookManage
{
partial class frmSearchBook
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSearchBook));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.dgvSearchBook = new System.Windows.Forms.DataGridView();
this.button1 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvSearchBook)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.BackgroundImage = global::图书馆管理.Properties.Resources._4863746_172156023334_2;
this.groupBox1.Controls.Add(this.comboBox2);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(9, 6);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Size = new System.Drawing.Size(252, 258);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查询条件";
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(104, 126);
this.comboBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(112, 28);
this.comboBox2.TabIndex = 8;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(104, 182);
this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(111, 26);
this.textBox2.TabIndex = 7;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(105, 53);
this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(112, 28);
this.comboBox1.TabIndex = 3;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(20, 188);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(79, 20);
this.label3.TabIndex = 2;
this.label3.Text = "主要内容:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(20, 126);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 20);
this.label2.TabIndex = 1;
this.label2.Text = "图书名称:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 60);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 20);
this.label1.TabIndex = 0;
this.label1.Text = "图书类别:";
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(149, 340);
this.btnClose.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(77, 39);
this.btnClose.TabIndex = 9;
this.btnClose.Text = "取消";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// groupBox2
//
this.groupBox2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("groupBox2.BackgroundImage")));
this.groupBox2.Controls.Add(this.dgvSearchBook);
this.groupBox2.Location = new System.Drawing.Point(269, 14);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox2.Size = new System.Drawing.Size(276, 417);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询结果";
//
// dgvSearchBook
//
this.dgvSearchBook.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
this.dgvSearchBook.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSearchBook.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSearchBook.GridColor = System.Drawing.SystemColors.ButtonHighlight;
this.dgvSearchBook.Location = new System.Drawing.Point(4, 24);
this.dgvSearchBook.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.dgvSearchBook.Name = "dgvSearchBook";
this.dgvSearchBook.RowTemplate.Height = 23;
this.dgvSearchBook.Size = new System.Drawing.Size(268, 388);
this.dgvSearchBook.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(33, 335);
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(77, 44);
this.button1.TabIndex = 8;
this.button1.Text = "查询";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnSerch_Click);
//
// frmSearchBook
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::图书馆管理.Properties.Resources._4863746_172156023334_2;
this.ClientSize = new System.Drawing.Size(561, 449);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "frmSearchBook";
this.Text = "查询界面";
this.Load += new System.EventHandler(this.frmSearchBook_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvSearchBook)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGridView dgvSearchBook;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox comboBox2;
}
}
#region
////用户登录菜单的事件处理
//private void 用户登录ToolStripMenuItem_Click(object sender, EventArgs e)
//{ //检测该窗口是否处于打开状态
// if (this.checkchildfrm("frmLogin") == true)
// return; //窗口已经打开,返回
// //frmLogin user = new frmLogin();//实例化登录窗体
// user.ShowDialog(); //登录窗体以模式对话框的方式的打开
// //判断是否登录成功,登录成功则启用相应的菜单和按钮
// if (result == DialogResult.OK)
// {
// this.tsbtnAddBook.Enabled = true;
// this.mnuUpdateBook.Enabled = true;
// this.mnuAddBook.Enabled = true;
// }
//}
////图书检索菜单Click事件处理
//private void 图书检索ToolStripMenuItem_Click(object sender, EventArgs e)
//{
// if (this.checkchildfrm("frmSearchBook") == true)
// return;
// frmSearchBook book = new frmSearchBook();
// book.MdiParent = this;
// book.Show();
//}
////图书入库菜单Click事件处理
//private void 图书入库ToolStripMenuItem1_Click(object sender, EventArgs e)
//{
// if (this.checkchildfrm("frmAddBook") == true)
// return;
// 添加图书界面 objbook = new 添加图书界面();
// objbook.MdiParent = this;
// objbook.Show();
//}
////图书入库按钮Click事件处理
//private void tsbtnAddBook_Click(object sender, EventArgs e)
//{
// if (this.checkchildfrm("frmUpdateBook") == true)
// return;
// frmUpdateBook objbook = new frmUpdateBook();
// objbook.MdiParent = this;
// objbook.Show();
//}
////图书更新菜单Click事件处理
//private void 图书修改ToolStripMenuItem_Click(object sender, EventArgs e)
//{
// if (this.checkchildfrm("frmUpdateBook") == true)
// return;
// frmUpdateBook objbook = new frmUpdateBook();
// objbook.MdiParent = this;
// objbook.Show();
//}
////图书借阅按钮事件处理
//private void tsbtnIssue_Click(object sender, EventArgs e)
//{
// if (this.checkchildfrm("frmIssueBook") == true)
// return;
// frmIssueBook issuebook = new frmIssueBook();
// issuebook.MdiParent = this;
// issuebook.Show();
//}
#endregion
private void FrmMain_Load_1(object sender, EventArgs e)
{
图书借阅ToolStripMenuItem.Enabled = false;
图书管理ToolStripMenuItem.Enabled = false;
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("你确定要退出?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
e.Cancel = false;
else
e.Cancel = true;
}
private void 退出0ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void 查询图书ToolStripMenuItem_Click(object sender, EventArgs e)
{
//图书查询按钮Click事件处理
if (this.checkchildfrm("frmSearchBook") == true)
return;
frmSearchBook book = new frmSearchBook();
book.MdiParent = this; //设置为当前窗体的子窗体
book.Show();
}
private void 修改图书ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.checkchildfrm("frmAddBook") == true)
{
return;
}
frmUpdateBook update = new frmUpdateBook();
update.MdiParent = this;
update.Show();
}
private void 增加图书ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.checkchildfrm("frmAddBook") == true)
return;
添加图书界面 objbook = new 添加图书界面();
objbook.MdiParent = this;
objbook.Show();
}
private void 删除图书ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.checkchildfrm("frmAddBook") == true)
{
return;
}
frmUpdateBook update = new frmUpdateBook();
update.MdiParent = this;
update.Show();
}
private void 借阅图书ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.checkchildfrm("frmIssueBook") == true)
return;
frmIssueBook issuebook = new frmIssueBook();
issuebook.MdiParent = this;
issuebook.Show();
}
private void 系统帮助ToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("欢迎使用图书管理系统!如有问题请咨询工作人员!");
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (UName.Text.Trim()=="ls"&&UPsd.Text.Trim()=="123")
{
//作为管理员登陆
图书借阅ToolStripMenuItem.Visible = false;
图书管理ToolStripMenuItem.Enabled = true;
groupLogin.Visible = false;
}
else if (UName.Text.Trim() == "ls" && UPsd.Text.Trim() == "1234")
{
//作为一般用户登录
图书管理ToolStripMenuItem.Visible = false;
图书借阅ToolStripMenuItem.Enabled = true;
groupLogin.Visible = false;
}
else {
MessageBox.Show("用户名或密码错误");
}
}
private void 查询图书ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//图书查询按钮Click事件处理
if (this.checkchildfrm("frmSearchBook") == true)
return;
frmSearchBook book = new frmSearchBook();
book.MdiParent = this; //设置为当前窗体的子窗体
book.Show();
}
private void 返回ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmMain book = new FrmMain();
book.Show();
this.Visible = false;
}
}
}