目录1、绪论............................................................12、数据库设计......................................................12.1数据库分析....................................................12.1创建数据库....................................................43、界面设计........................................................43.1登陆界面......................................................43.2图书管理系统界面..............................................83.3图书信息界面..................................................93.4图书归还界面.................................................113.5图书借阅界面.................................................133.6用户信息界面.................................................153.7管理员界面...................................................163.8注册界面.....................................................183.9添加图书界面.................................................194、系统测试.......................................................214.1登陆功能...................................................214.2借阅图书功能...............................................224.3归还图书库功能.............................................224.4图书信息功能...............................................234.5管理员登陆功能.............................................234.6添加图书功能..............................................244.7用户信息...................................................245、连接数据库....................................................245.1连接数据库..................................................255.2操作数据库中的数据..........................................256、总结..........................................................271、绪论2、数据库设计2.1数据库分析本系统利用VisualStudio2010处理数据库的功能,实现对图书馆信息的管理。主要功能为管理有关用户、管理员、书籍和借阅的信息等。本系统的结构分为用户信息管理模块、书籍信息管理模块、借阅信息管理模块、管理者管理信息模块和查询处理模块。图书馆管理系统框图如图所示失败成功进入图书馆管理系统管理员用户登录图书管理查询图书增加图书查询图书借阅图书2.2创建数据库3、界面设计3.1登陆界面amespace图书管理系统{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}publicstaticFormfm=null;privatestaticintErrorTimes=0;privatevoidbutton3_Click(objectsender,EventArgse){this.Close();}privatevoidtextBox1_TextChanged(objectsender,EventArgse){}privatevoidbutton1_Click(objectsender,EventArgse){if(textBox1.Text==||textBox2.Text==){MessageBox.Show(提示:请输入用户名和密码!,警告);}SqlConnectionconn=newSqlConnection(Server=PC_201402131602;IntegratedSecurity=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_1whereid='+textBox1.Text.Trim()+'andus='+textBox2.Text.Trim()+',conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows){MessageBox.Show(登录成功!,提示);Form2fm=newForm2();fm.Show();this.Hide();}else{ErrorTimes++;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==){MessageBox.Show(提示:请输入用户名和密码!,警告);}SqlConnectionconn=newSqlConnection(Server=PC_201402131602;IntegratedSecurity=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_2whereuid='+textBox1.Text.Trim()+'andusr='+textBox2.Text.Trim()+',conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows){MessageBox.Show(登录成功!,提示);Form7fm=newForm7();fm.Show();this.Hide();}else{ErrorTimes++;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=newForm10();f2.Show();}}}3.2图书管理系统界面namespace图书管理系统{publicpartialclassForm2:Form{publicForm2(){InitializeComponent();}privatevoidbutton5_Click(objectsender,EventArgse){this.Close();}privatevoidbutton3_Click(objectsender,EventArgse){Form3f2=newForm3();f2.Show();this.Close();MessageBox.Show(您已成功进入----图书信息!);}privatevoidbutton2_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:Form{publicForm3(){InitializeComponent();}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.4归还图书namespace图书管理系统{publicpartialclassForm4:Form{publicForm4(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){if(textBox1.Text==){MessageBox.Show(提示:请输入所借书籍编号!,警告);}SqlConnectionconn=newSqlConnection(Server=PC_201402131602;IntegratedSecurity=true;DataBase=图书管理系统);conn.Open();SqlCommandcmd=newSqlCommand(select*fromTable_4wheresid='+textBox1.Text.Trim()+',conn);SqlDataReadersdr=cmd.ExecuteReader();sdr.Read();if(sdr.HasRows){MessageBox.Show(该书已还,提示);}else{sdr.Close();stringmyinsert=insertintoTable_4(sid)values('+textBox1.Text+');SqlCommandmycom=newSq