ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:36.55KB ,
资源ID:6508563      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6508563.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C#图书馆管理系统.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C#图书馆管理系统.docx

1、C#图书馆管理系统2.1创建数据库 41353.7管理员界面 163.8注册界面 183.9添加图书界面 191122334.6添加图书功能 244.7用户信息 2445.1连接数据库 255.2操作数据库中的数据 2571、绪论2、数据库设计2.1数据库分析本系统利用VisualStudio2010处理数据库的功能,实现对图书馆信息的管理。主要功能为管理有关用户、管理员、书籍和借阅的信息等。本系统的结构分为用户信息管理模块、书籍信息管理模块、借阅信息管理模块、管理者管理信息模块和查询处理模块。图书馆管理系统框图如图所示 失败 成功2.2创建数据库3、界面设计3.1登陆界面amespace图书

2、管理系统publicpartialclassForm1:FormpublicForm1()InitializeComponent();publicstaticFormfm=null;privatestaticintErrorTimes=0;privatevoidbutton3_Click(objectsender,EventArgse)this.Close();privatevoidtextBox1_TextChanged(objectsender,EventArgse)privatevoidbutton1_Click(objectsender,EventArgse)if(textBox1.T

3、ext=|textBox2.Text=)MessageBox.Show(提示:请输入用户名和密码!,警告);SqlConnectionconn=newSqlConnection(Security=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_1whereid=+textB+andus=+,conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows)MessageBox.Show(登录成功!,提示);Form

4、2fm=newForm2();fm.Show();this.Hide();elseErrorTimes+;MessageBox.Show(用户名或密码不正确!您还有+(3-ErrorTimes)+次输入密码的机会,请重新输入!如果超过3次,系统将自动关闭);if(ErrorTimes=3)ErrorTimes=0;conn.Close();privatevoidForm1_Load(objectsender,EventArgse)privatevoidbutton4_Click(objectsender,EventArgse)if(textBox1.Text=|textBox2.Text=)M

5、essageBox.Show(提示:请输入用户名和密码!,警告);SqlConnectionconn=newSqlConnection(Security=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_2whereuid=+text+andusr=+,conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows)MessageBox.Show(登录成功!,提示);Form7fm=newForm7();fm.Sh

6、ow();this.Hide();elseErrorTimes+;MessageBox.Show(用户名或密码不正确!您还有+(3-ErrorTimes)+次输入密码的机会,请重新输入!如果超过3次,系统将自动关闭);if(ErrorTimes=3)ErrorTimes=0;conn.Close();privatevoidbutton2_Click(objectsender,EventArgse)Form8f1=newForm8();f1.Show();privatevoidbutton5_Click(objectsender,EventArgse)this.Hide();Form10f2=n

7、ewForm10();f2.Show();3.2图书管理系统界面namespace图书管理系统publicpartialclassForm2:FormpublicForm2()InitializeComponent();privatevoidbutton5_Click(objectsender,EventArgse)this.Close();privatevoidbutton3_Click(objectsender,EventArgse)Form3f2=newForm3();f2.Show();this.Close();MessageBox.Show(您已成功进入-图书信息!);private

8、voidbutton2_Click(objectsender,EventArgse)Form4f4=newForm4();f4.Show();this.Close();MessageBox.Show(您已成功进入-还书系统!);privatevoidbutton1_Click(objectsender,EventArgse)Form5f5=newForm5();f5.Show();this.Close();MessageBox.Show(您已成功进入-借书系统!);3.3图书信息namespace图书管理系统publicpartialclassForm3:FormpublicForm3()In

9、itializeComponent();privatevoidForm3_Load(objectsender,EventArgse)/TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_3”中。您可以根据需要移动或删除它。this.table_3TableAdapter.Fill(this.图书管理系统DataSet.Table_3);privatevoidtextBox1_TextChanged(objectsender,EventArgse)privatevoidbutton1_Click(objectsender,EventArgse)this.Close();3.

10、4归还图书namespace图书管理系统publicpartialclassForm4:FormpublicForm4()InitializeComponent();privatevoidbutton1_Click(objectsender,EventArgse)if(textBox1.Text=)MessageBox.Show(提示:请输入所借书籍编号!,警告);SqlConnectionconn=newSqlConnection(Security=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fro

11、mTable_4wheresid=+,conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows)MessageBox.Show(该书已还,提示);elsesdr.Close();stringmyinsert=insertintoTable_4(sid)values(+textBox1.Text+);SqlCommandmycom=newSqlCommand(myinsert,conn);mycom.ExecuteNonQuery();conn.Close();conn.Dispose();MessageBox.Sh

12、ow(您已还书成功!);privatevoidForm4_Load(objectsender,EventArgse)/TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_4”中。您可以根据需要移动或删除它。this.table_4TableAdapter.Fill(this.图书管理系统DataSet.Table_4);/TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_3”中。您可以根据需要移动或删除它。this.table_3TableAdapter.Fill(this.图书管理系统DataSet.Table_3);privatevoidbut

13、ton2_Click(objectsender,EventArgse)this.Close();Form2f2=newForm2();f2.Show();3.5已借图书namespace图书管理系统publicpartialclassForm5:FormpublicForm5()InitializeComponent();privatevoidbutton1_Click(objectsender,EventArgse)this.Close();Form2f2=newForm2();f2.Show();privatevoidForm5_Load(objectsender,EventArgse)/

14、TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_4”中。您可以根据需要移动或删除它。this.table_4TableAdapter.Fill(this.图书管理系统DataSet.Table_4);/TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_3”中。您可以根据需要移动或删除它。this.table_3TableAdapter.Fill(this.图书管理系统DataSet.Table_3);privatevoidbutton2_Click(objectsender,EventArgse)if(textBox1.Text=)Messag

15、eBox.Show(提示:请输入所借书籍编号!,警告);SqlConnectionconn=newSqlConnection(Security=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_4wheresid=+,conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows)MessageBox.Show(该书已借,提示);elsesdr.Close();stringmyinsert=insertintoTa

16、ble_4(sid)values(+textBox1.Text+);SqlCommandmycom=newSqlCommand(myinsert,conn);mycom.ExecuteNonQuery();conn.Close();conn.Dispose();MessageBox.Show(您已借书成功!);privatevoidtextBox2_TextChanged(objectsender,EventArgse)3.6用户信息namespace图书管理系统publicpartialclassForm6:FormpublicForm6()InitializeComponent();pri

17、vatevoidForm6_Load(objectsender,EventArgse)/TODO:这行代码将数据加载到表“图书管理系统DataSet.Table_1”中。您可以根据需要移动或删除它。this.table_1TableAdapter.Fill(this.图书管理系统DataSet.Table_1);privatevoidbutton1_Click(objectsender,EventArgse)this.Close();3.7管理员主界面namespace图书管理系统publicpartialclassForm7:FormpublicForm7()InitializeCompon

18、ent();privatevoidbutton2_Click(objectsender,EventArgse)Form6f1=newForm6();f1.Show();MessageBox.Show(您已成功进入-用户信息!);privatevoidbutton3_Click(objectsender,EventArgse)Form3f2=newForm3();f2.Show();MessageBox.Show(您已成功进入-图书信息!);privatevoidbutton1_Click(objectsender,EventArgse)Form9f2=newForm9();f2.Show();

19、MessageBox.Show(您已成功进入-添加图书系统!);privatevoidbutton4_Click(objectsender,EventArgse)this.Close();3.8注册界面namespace图书管理系统publicpartialclassForm8:FormpublicForm8()InitializeComponent();privatevoidbutton1_Click(objectsender,EventArgse)if(textBox1.Text=|textBox2.Text=)MessageBox.Show(提示:请输入用户名和密码!,警告);SqlCo

20、nnectionconn=newSqlConnection(Security=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromtable_1whereid=+andus=+,conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows)MessageBox.Show(该用户已注册,请使用其他用户名,提示);elsesdr.Close();stringmyinsert=insertintotable_1(id,us)valu

21、es(+textBox1.Text+,+textBox2.Text+);SqlCommandmycom=newSqlCommand(myinsert,conn);mycom.ExecuteNonQuery();conn.Close();conn.Dispose();MessageBox.Show(您已注册成功!);privatevoidbutton2_Click(objectsender,EventArgse)this.Close();privatevoidForm8_Load(objectsender,EventArgse)3.9添加图书namespace图书管理系统publicpartia

22、lclassForm9:FormpublicForm9()InitializeComponent();privatevoidbutton2_Click(objectsender,EventArgse)privatevoidbutton1_Click(objectsender,EventArgse)SqlConnectionconn=newSqlConnection(Security=true);stringsql=insertintoTable_3(sid,sdata,sname)values(+textBox1.Text+,+textBox2.Text+,+textBox3.Text+);c

23、onn.Open();SqlCommandcomm=newSqlCommand(sql,conn);if(conn.State=ConnectionState.Closed)conn.Open();if(Convert.ToInt32(comm.ExecuteNonQuery()0)label4.Text=成功!;MessageBox.Show(您已成功添加数据!);elselabel4.Text=失败!;4、系统测试登陆借阅图书归还图书图书信息管理员登陆添加图书用户信息5、连接数据库为数据库BookManage和本系统之间建立一个数据连接。(1)在服务器资源管理器中右击“数据连接”节点(VS

24、2008中操作)。在弹出的快捷菜单中执行“添加连接”命令,打开DataLinkProperties对话框。切换到Provider选项卡,选中列表框中的MicrosoftOLEDBProviderforSQLServer项。单击“下一步”切换到Connection选项卡。(2)在其中的第一个下拉列表框中选择数据库所在服务器名称。输入登录服务器信息后选择数据库BookManage,然后单击测试按钮。如果测试成功,单击“确定”按钮。5.1连接数据库(1)定义数据库连接字符串,代码如下:PrivatestaticstringConnectString=DataSource=(local)sqlexpr

25、ess;DataBase=BookManage.mdf;(2)创建Connection对象,代码如下:SqlConnectioncon=newSqlConnection(ConnectString);(3)打开连接,代码如下:con.Open();(4)关闭连接,代码如下:con.Close();5.2操作数据库中的数据usingSystem;usingusingSystem.Linq;usingSystem.Text;usingSystem.Data;usingnamespaceBookManageclassDataAccessprivatestaticstringConnectString

26、=DataSource=SQLEXPRESS;AttachDbFilename=F:BookManagedataBookManage.mdf;IntegratedSecurity=False;/数据库连接字符串/根据表名获取数据集的表/publicstaticDataTableGetDataSetByTableName(stringtable)using(SqlConnectioncon=newSqlConnection(ConnectString)/创建数据库连接对象stringsql=select*from+table+;/查询sql语句trySqlDataAdapteradapter=n

27、ewSqlDataAdapter(sql,con);/创建适配器对象DataSetds=newDataSet();/创建数据集对象adapter.Fill(ds,table);/填充数据集returnds.Tables0;/返回数据表catch(SqlExceptionex)thrownewException(ex.Message);publicstaticDataSetGetDataSetBySql(stringsql)using(SqlConnectioncon=newSqlConnection(ConnectString)/创建数据库连接对象SqlDataAdapteradapter=n

28、ewSqlDataAdapter(sql,con);/创建适配器对象DataSetds=newDataSet();/创建数据集对象tryadapter.Fill(ds);/填充数据集returnds;/返回数据集catch(SqlExceptionex)thrownewException(ex.Message)publicstaticSqlDataReaderGetDataReaderByID(intid)using(SqlConnectioncon=newSqlConnection(ConnectString)stringsql=select*frombookinfowherebookid=+id;/sql语句trySqlCommandcomm=newSqlCommand(sql,con);/创建Command对象con.Open();/打开连接SqlDataReaderreader=comm.ExecuteReader();/创建DataReader对象reader.Read();/

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1