Sql_server数据库课程设计_图书馆管理系统【范本模板】

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

数据库课程设计
设计选题:图书管理系统
系别信息工程系
专业计算机网络技术
班级 2010022201
姓名马斌龙
学号 201002220137
姓名王贤宽
学号 201002220137
姓名黄晓辉
学号 201002220140
指导老师
2011年12月29日
一.系统需求分析
图书管理工作繁琐,借阅频繁,包含大量的信息数据,因此就需要一个完善的图书管理系统来实现对这些数据的有效管理。

本系统主要任务就是对图书、读者、借阅信息、查询进行
统一管理,满足各类用户的需求。

本系统在功能上要实现借阅图书、续借图书、归还图书、催还图书、信息查询等功能。

二.数据库分析
图书管理系统就是要求图书管理人员通过该系统对图书、读者、借阅信息等进行统一管理,从而实现功能上的借阅图书、
续借图书、归还图书、催还图书以及信息查询。

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

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

1 前台算法实现
5。

1。

1 主界面
<!DOCTYPE html PUBLIC”—//W3C//DTD XHTML 1.0
Transitional//EN" ”/TR/xhtml1/DTD/xhtml1—t ransitional.dtd">
〈html xmlns=”http://www.w3。

org/1999/xhtml” 〉
〈head>
<title>欢迎使用图书管理系统〈/title〉
〈/head〉
<body style=”tex t—align:center”〉
<span style=”font—size: 24pt"〉
<br />
<br />
〈br /〉
<a href=".\book。

aspx">图书信息查询〈/a>〈br />
〈br />
<a href=".\reader.aspx”〉读者信息查询</a〉〈br /〉
<br /〉
〈a href="。

\record。

aspx"〉借还信息记录</a></span>
</body>
</html〉
5。

1.2 图书信息
〈!DOCTYPE html PUBLIC "—//W3C//DTD XHTML 1.0
Transitional//EN” ”http://www。

w3。

org/TR/xhtml1/DTD/xhtml1-transitional。

dtd”〉
<html xmlns="http://www.w3。

org/1999/xhtml" >
〈head runat="server”〉
<title〉无标题页〈/title〉
〈/head〉
<body>
〈form id="form1" runat=”server”〉
〈div style="text—align:center”>
〈asp:Label ID="Label1" runat=”server" Text="书名”></asp:Label>
<asp:TextBox ID="TextBox1” runat=”server"></asp:TextBox〉
<br /〉
〈asp:Button ID="Button1” runat="server" OnClick=”Button1_Click1" Text=”查询” /><br />
〈asp:GridView ID="GridView1" runat="server" OnSelectedIndexChanged=”GridView1_SelectedIndexChanged"〉 </asp:GridView>
</div〉
〈/form>
</body〉
〈/html〉
5.1.3 读者信息
<!DOCTYPE html PUBLIC "—//W3C//DTD XHTML 1.0
Transitional//EN" ”http://www。

/TR/xhtml1/DTD/xhtml1—transitional。

dtd"〉
〈html xmlns="http:///1999/xhtml" 〉
〈head id="Head1" runat="server”>
〈title>无标题页</title〉
</head〉
〈body〉
<form id=”form1" runat="server">
〈div style="text-align: center">
〈asp:Label ID=”Label1” runat=”server" Text=”姓名”>〈/asp:Label〉
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox〉
<br /〉
<asp:Button ID=”Button1” runat=”server"
OnClick="Button1_Click1" Text="查询” /〉〈br /〉
〈asp:GridView ID=”GridView1" runat="server" OnSelectedIndexChanged="GridView1_SelectedIndexChanged”>
</asp:GridView〉
〈/div〉
〈/form〉
</body〉
</html〉
5。

1.4 借还信息表
<!DOCTYPE html PUBLIC "—//W3C//DTD XHTML 1.0 Transitional//EN” "http://www。

w3。

org/TR/xhtml1/DTD/xhtml1—transitional。

dtd"> 〈html xmlns="http://www.w3。

org/1999/xhtml” 〉
〈head runat=”server"〉
<title>无标题页〈/title〉
〈/head>
<body>
<form id=”form1” runat=”server”>
<div〉
</div>
</form〉
〈/body>
</html〉
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;
com。

CommandText = "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;
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;
com。

CommandText = "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;
com。

CommandText = ”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打好了坚实的基础。

我相信我以后会制作出很好的数据库系统。

相关文档
最新文档