当前位置:文档之家› Sql-server数据库课程设计-图书馆管理系统

Sql-server数据库课程设计-图书馆管理系统

Sql-server数据库课程设计-图书馆管理系统
Sql-server数据库课程设计-图书馆管理系统

数据库课程设计

设计选题:图书管理系统

系别信息工程系

专业计算机网络技术

班级 2010022201

姓名马斌龙

学号 201002220137

姓名王贤宽

学号 201002220137

姓名黄晓辉

学号 201002220140

指导老师

2011年12月29日

一.系统需求分析

图书管理工作繁琐,借阅频繁,包含大量的信息数据,因此就需要一个完善的图书管理系统来实现对这些数据的有效管理。本系统主要任务就是对图书、读者、借阅信息、查询进行

统一管理,满足各类用户的需求。本系统在功能上要实现借阅图书、续借图书、归还图书、催还图书、信息查询等功能。二.数据库分析

图书管理系统就是要求图书管理人员通过该系统对图书、读者、借阅信息等进行统一管理,从而实现功能上的借阅图书、

续借图书、归还图书、催还图书以及信息查询。这就要求管理人员能够对数据库进行熟练操作而简单的表查询、触发器的建立、存储过程的建立以及用户自定义函数的建立等等这些管理数据库的方法都能对图书馆里系统的管理起到事半功倍的效果。

五、图书馆管理系统功能算法实现

5.1 前台算法实现

5.1.1 主界面

欢迎使用图书管理系统




图书信息查询


读者信息查询


借还信息记录

5.1.2 图书信息

无标题页

runat="server">


OnClick="Button1_Click1" Text="查询" />

5.1.3 读者信息

无标题页

runat="server">


OnClick="Button1_Click1" Text="查询" />

5.1.4 借还信息表

无标题页

5.1.5添加图书

using System;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class add : System.Web.UI.Page

{

protected void Button1_Click1(object sender, EventArgs e) {

string s1, s2, s3;

s1 = TextBox1.Text;

s2 = TextBox2.Text;

s3 = TextBox3.Text;

string str = "server=WINKS80;database=图书管理系

统;integrated security=true";

SqlConnection con = new SqlConnection(str);

SqlCommand com = new SqlCommand();

try

{

com.Connection = con;

https://www.doczj.com/doc/d819021769.html,mandText = "insert 图书信息表 values ('" + s1 + "','" + s2 + "','" + s3 + "')";

con.Open();

com.ExecuteNonQuery();

con.Close();

Response.Write("插入成功");

catch (Exception a1)

{

Response.Write("插入失败");

finally

{

con.Close();

}

}

5.1.6 删除图书

protected void Button3_Click(object sender, EventArgs e)

{

string s4;

s4 = TextBox4.Text;

string str = "server=WINKS80;database=图书管理系统;integrated security=true";

SqlConnection con = new SqlConnection(str);

SqlCommand com = new SqlCommand();

try

{

com.Connection = con;

https://www.doczj.com/doc/d819021769.html,mandText = "delete 图书信息表where bname = '" + s4 + "'";

con.Open();

com.ExecuteNonQuery();

con.Close();

Response.Write("删除成功");

}

catch (Exception a1)

{

Response.Write("删除失败");

}

finally

{

con.Close();

}

}

}

5.1.7添加读者

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class manger : System.Web.UI.Page

{

protected void Button1_Click(object sender, EventArgs e) {

string s1, s2, s3;

s1 = TextBox1.Text;

s2 = TextBox2.Text;

s3 = TextBox3.Text;

string str = "server=WINKS80;database=图书管理系

统;integrated security=true";

SqlConnection con = new SqlConnection(str);

SqlCommand com = new SqlCommand();

try

{

com.Connection = con;

https://www.doczj.com/doc/d819021769.html,mandText = "insert 读者信息表 values ('" + s1 + "','" + s2 + "','" + s3 + "')";

con.Open();

com.ExecuteNonQuery();

con.Close();

Response.Write("添加成功");

}

catch (Exception a1)

{

Response.Write("添加失败");

}

finally

{

con.Close();

}

}

5.1.7删除读者、

using System;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

protected void Button2_Click(object sender, EventArgs e) {

string s4;

s4 = TextBox4.Text;

string str = "server=WINKS80;database=图书管理系统;integrated security=true";

SqlConnection con = new SqlConnection(str);

SqlCommand com = new SqlCommand();

try

{

com.Connection = con;

https://www.doczj.com/doc/d819021769.html,mandText = "delete 读者信息表where rname = '" + s4 + "'";

con.Open();

com.ExecuteNonQuery();

con.Close();

Response.Write("删除成功");

}

catch (Exception a1)

{

Response.Write("删除失败");

}

finally

{

con.Close();

}

}

}

5.2后台算法实现

5.2.1 创建数据库(图书管理系统)

create database 图书管理系统

5.2.2 创建图书信息表

create table 图书信息表

( bid char(10) not null primary key,

bname nvarchar(15) not null,

bkind varchar(8) not null

)

5.2.3 创建读者信息表

create table 读者信息表

( rid char(10) not null primary key,

rname nvarchar(15) not null,

rkind varchar(8) not null

)

5.2.4 创建借还书信息表

create table 借还书信息表

( recordid bigint identity(1,1) not null primary key,

bid char(10) foreign key references 图书信息表(bid),

btimes bigint not null,

retime smalldatetime not null,

bstat bit not null

)

六.实训心得

通过本次的课程设计,我清楚的感觉SQL的重要性。在生活或工作中有很大的实用性。而本次实训又让我从新认识到了SQL模型的创建、应用、完整的数据库管理系统。现在我正在努力掌握SQL数据库管理系统及其应用开发技术。这次的试训让我更好的掌握SQL打好了坚实的基础。我相信我以后会制作出很好的数据库系统。

(注:可编辑下载,若有不当之处,请指正,谢谢!)

相关主题
文本预览
相关文档 最新文档