歡迎來(lái)到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁(yè) 裝配圖網(wǎng) > 資源分類 > DOCX文檔下載  

C MySQL 圖書管理系統(tǒng).docx

  • 資源ID:16731564       資源大?。?span id="glj2msp" class="font-tahoma">559.73KB        全文頁(yè)數(shù):19頁(yè)
  • 資源格式: DOCX        下載積分:5積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要5積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號(hào),方便查詢和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開,此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁(yè)到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無(wú)水印,預(yù)覽文檔經(jīng)過(guò)壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說(shuō)明有答案則都視為沒有答案,請(qǐng)知曉。

C MySQL 圖書管理系統(tǒng).docx

C#面向?qū)ο蟪绦蛟O(shè)計(jì)課程設(shè)計(jì)圖書借閱管理系統(tǒng)源碼下載地址:http:/pan.baidu.com/s/1eRCzK2m院 系:計(jì)算機(jī)學(xué)院專 業(yè):計(jì)算機(jī)科學(xué)與技術(shù)年 級(jí):2014級(jí)學(xué)生姓名:/ 學(xué) 號(hào):/教 師:/日 期: 2017年6月6日開發(fā)和運(yùn)行環(huán)境- 開發(fā)環(huán)境:Windows 10-1703;- 開發(fā)工具:Visual Studio 013 Update5;- 數(shù)據(jù)庫(kù)工具:Mysql 5.7 + NaviCat;- 運(yùn)行環(huán)境:Windows 10-1703;需求分析1.【角色】用戶通過(guò)【注冊(cè)】成為本系統(tǒng)的可訪問成員,通過(guò)【登陸】進(jìn)入系統(tǒng)。用戶可以操作的功能有:-查看圖書館的所有圖書信息,圖書的是否可借閱信息;-搜索功能:通過(guò)輸入關(guān)鍵字,來(lái)查找是否有自己需要的圖書;-借閱功能:未被其他用戶借閱的書籍可以直接借閱;-還書功能:若存在之前借閱的書籍,在未歸還的情況下,可以進(jìn)行還書操作,若未存在需要還的書籍,提示:未有需要?dú)w還的書籍;-個(gè)人信息:修改除了【用戶名】以外之前注冊(cè)的全部信息;-借閱信息:可以查看借閱歷史,曾經(jīng)的借書日期和還書日期,是否有未歸還的書等等;2.【角色】管理員通過(guò)【登陸】進(jìn)入用戶進(jìn)入不了的管理系統(tǒng)。管理員可以操作的功能有:-圖書信息修改:修改除了圖書名的現(xiàn)有的所有圖書信息;-添加圖書:添加新的圖書;-查看用戶信息:可以查看用戶表的部分用戶信息;3數(shù)據(jù)保存:需要長(zhǎng)期保存在數(shù)據(jù)庫(kù)的數(shù)據(jù)有:-圖書信息:圖書的基本信息;-讀者信息:讀者的基本信息;-借閱信息:圖書的借閱信息;-帳號(hào)信息:圖書管理員和讀者的登錄帳號(hào); 系統(tǒng)流程圖(不包含注冊(cè)功能)數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明- 管理員表:adminInfo;- 圖書信息表:bookInfo;- 借閱信息表:borrowed;- 用戶信息表:userInfo;adminInfo表列名數(shù)據(jù)類型可否為空長(zhǎng)度說(shuō)明adminIdint否11管理員IDadminNamevarchar否255管理員用戶名adminPasswordvarchar否255管理員密碼bookInfo表列名數(shù)據(jù)類型可否為空長(zhǎng)度說(shuō)明bookIdint否11圖書編號(hào)IDbookNamevarchar否255圖書名bookAuthorvarchar否255圖書作者bookPriceint否11圖書價(jià)格bookPressvarchar否255圖書出版社bookTypevarchar是255圖書類型isBorrowedtinyint是11是否被借閱borrowIdint是11借閱人的IDBorrowedTimedatetime是0被借閱的時(shí)間borrowed表列名數(shù)據(jù)類型可否為空長(zhǎng)度說(shuō)明borrowedIdint否11借閱信息IDuserIdint是11操作人IDuserNamevarchar是255操作人用戶名bookIdint是11圖書IDeditTimedatatime是0操作時(shí)間bookNamevarchar是255圖書名editvarchar是255操作名UserInfo表列名數(shù)據(jù)類型可否為空長(zhǎng)度說(shuō)明userIdint否11用戶IDuserNamevarchar否255用戶名userPasswordvarchar否255用戶密碼userSexvarchar是255用戶性別模塊分析cs文件:主界面:主要顯示代碼 mainCenter.cs :public mainCenter() InitializeComponent(); string sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open();/打開數(shù)據(jù)庫(kù)連接 MySqlDataAdapter data1 = new MySqlDataAdapter();/實(shí)例化sqldataadpter MySqlCommand cmd1 = new MySqlCommand("SELECT bookName as 圖書名,bookAuthor as 作者,bookPrice as 圖書價(jià)格,bookPress as 出版社,bookType as 圖書類型,(CASE isBorrowed WHEN 0 THEN 未借閱 ELSE 已借閱 END) as借閱情況 FROM c#librarycenter.bookinfo", conn);/sql語(yǔ)句 data1.SelectCommand = cmd1;/設(shè)置為已實(shí)例化SqlDataAdapter的查詢命令 DataTable dt = new DataTable(); dt.Clear(); data1.Fill(dt);/把數(shù)據(jù)填充到datatable dataGridView1.DataSource = dt;/將數(shù)據(jù)集綁定datagridview,完成顯示 dataGridView1.AllowUserToAddRows = false; / login login = new login(); label1.Text = "這里是SMART-LIBRARY!用戶:" + login.username; / 查找功能:主要實(shí)現(xiàn)代碼:private void button1_Click(object sender, EventArgs e) String so = textBox1.Text; String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open();/打開數(shù)據(jù)庫(kù)連接 MySqlDataAdapter data1 = new MySqlDataAdapter();/實(shí)例化sqldataadpter MySqlCommand cmd1 = new MySqlCommand("SELECT bookName as 圖書名,bookAuthor as 作者,bookPrice as 圖書價(jià)格,bookPress as 出版社,bookType as 圖書類型,(CASE isBorrowed WHEN 0 THEN 未借閱 ELSE 已借閱 END) as借閱情況 FROM c#librarycenter.bookinfo where bookName like %"+ so +"% ", conn);/sql語(yǔ)句 data1.SelectCommand = cmd1;/設(shè)置為已實(shí)例化SqlDataAdapter的查詢命令 /DataSet ds1 = new DataSet();/實(shí)例化dataset DataTable dt = new DataTable(); dt.Clear(); data1.Fill(dt);/把數(shù)據(jù)填充到datatable dataGridView1.DataSource = dt;/將數(shù)據(jù)集綁定datagridview,完成顯示 dataGridView1.AllowUserToAddRows = false; 借閱功能:主要實(shí)現(xiàn)代碼 - borrow.cs:private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) int r = this.dataGridView1.CurrentRow.Index; string h = this.dataGridView1.Rowsr.Cells1.Value.ToString(); string s = this.dataGridView1.Rowsr.Cells2.Value.ToString(); / login login = new login(); String userId = "" DateTime dt = DateTime.Now; String borrowedTime = dt.ToString("yyyy-MM-dd HH:mm:ss"); string sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); String updateBorrow1 = "select userId from userInfo where userName = "+login.username+"" MySqlCommand mysqlcommand = new MySqlCommand(updateBorrow1,conn); conn.Open(); MySqlDataReader mdr = mysqlcommand.ExecuteReader(); if (mdr.Read() userId = mdr.GetString(0).ToString(); mdr.Close(); String updateBorrow2 = "update bookInfo set isBorrowed = 1, borrowId = " + userId + ",borrowedTime =" + borrowedTime + " where bookId = " + h + "" / MySqlCommand mysqlcommand2 = new MySqlCommand(updateBorrow2, conn); int i = mysqlcommand2.ExecuteNonQuery(); if (i != -1) MessageBox.Show(login.username + " rn恭喜你借" + " << " + s + " >> rn這本書" + "成功"); else MessageBox.Show("系統(tǒng)出了點(diǎn)問題,請(qǐng)聯(lián)系管理員!"); /更新借閱表 String updateBorrow3 = "insert into borrowed(userId,userName,bookId,editTime,bookName,edit) values(" + userId + "," + login.username + "," + h + "," + borrowedTime + "," + s + ",借書)" MySqlCommand mysqlcommand3 = new MySqlCommand(updateBorrow3, conn); mysqlcommand3.ExecuteNonQuery(); /刷新dataGridView1,重新綁定數(shù)據(jù)源 f5(); 歸還圖書功能:主要實(shí)現(xiàn)代碼 returnbook.cs:private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) int r = this.dataGridView1.CurrentRow.Index; string h = this.dataGridView1.Rowsr.Cells1.Value.ToString(); string s = this.dataGridView1.Rowsr.Cells2.Value.ToString(); DateTime dt = DateTime.Now; String returnedTime = dt.ToString("yyyy-MM-dd HH:mm:ss"); String userId = "" string sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open(); / String updateBorrow1 = "update bookInfo set isBorrowed = 0,borrowId = null,borrowedTime = null where bookId = "+h+"" MySqlCommand mysqlcommand2 = new MySqlCommand(updateBorrow1, conn); int i = mysqlcommand2.ExecuteNonQuery(); if (i != -1) MessageBox.Show(login.username + " rn<< " + s + " >> rn這本書,還書成功"); else MessageBox.Show("系統(tǒng)出了點(diǎn)問題,請(qǐng)聯(lián)系管理員!"); /更新借閱表 String updateBorrow = "select userId from userInfo where userName = " + login.username + "" MySqlCommand mysqlcommand = new MySqlCommand(updateBorrow, conn); MySqlDataReader mdr = mysqlcommand.ExecuteReader(); if (mdr.Read() userId = mdr.GetString(0).ToString(); mdr.Close(); String updateBorrow2 = "insert into borrowed(userId,userName,bookId,editTime,bookName,edit) values(" + userId + "," + login.username + "," + h + "," + returnedTime + "," + s + ",還書)" MySqlCommand mysqlcommand3 = new MySqlCommand(updateBorrow2, conn); mysqlcommand3.ExecuteNonQuery(); /刷新dataGridView1,重新綁定數(shù)據(jù)源 f5(); 修改個(gè)人信息:主要實(shí)現(xiàn)代碼 editUser.cs:private void button1_Click(object sender, EventArgs e) login login = new login(); String pw = textBox1.Text; String npw = textBox2.Text; String un = login.username; String userPassword = "" String userId = "" if (male.Checked = true) ans = "male" if (female.Checked = true) ans = "female" String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open(); / String yanzheng = "SELECT userPassword FROM userinfo where userName = "+login.username+"" MySqlCommand yz = new MySqlCommand(yanzheng,conn); MySqlDataReader mdr2 = yz.ExecuteReader(); if (mdr2.Read() userPassword = mdr2.GetString(0); mdr2.Close(); if (textBox2.Text.Trim() != "") if (pw = userPassword) / String editsql1 = "select userId from userInfo where userName = " + login.username + " " MySqlCommand cmd1 = new MySqlCommand(editsql1, conn); MySqlDataReader mdr = cmd1.ExecuteReader(); if (mdr.Read() userId = mdr.GetString(0); else mdr.Close(); / String editsql2 = "update userInfo set userPassword = " + npw + ", userSex = " + ans + "where userId = " + userId + "" MySqlCommand cmd2 = new MySqlCommand(editsql2, conn); int i = cmd2.ExecuteNonQuery(); if (i = 1) MessageBox.Show(login.username + "rn您的信息修改成功!rn請(qǐng)牢記您現(xiàn)在的密碼"); else MessageBox.Show("修改失敗,請(qǐng)聯(lián)系管理員"); else MessageBox.Show("你的原密碼輸入錯(cuò)誤,請(qǐng)重新輸入啊啊啊"); else MessageBox.Show("新的密碼請(qǐng)不要填空!"); 查詢借閱信息:主要實(shí)現(xiàn)代碼 borrowedinfo.cs:public borrowedinfo() InitializeComponent(); label1.Text = login.username + " ,以下是您的借閱記錄:" String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open();/打開數(shù)據(jù)庫(kù)連接 String userId = "" MySqlCommand cmd = new MySqlCommand("select userId from borrowed where userName = "+ login.username +"",conn); MySqlDataReader mdr = cmd.ExecuteReader(); if (mdr.Read() userId = mdr.GetString(0); mdr.Close(); MySqlDataAdapter data1 = new MySqlDataAdapter();/實(shí)例化sqldataadpter MySqlCommand cmd1 = new MySqlCommand("select bookId as 圖書編號(hào),bookName as 圖書名,editTime as 操作時(shí)間,edit as 操作 from borrowed where userId = "+ userId +"", conn);/sql語(yǔ)句 data1.SelectCommand = cmd1;/設(shè)置為已實(shí)例化SqlDataAdapter的查詢命令 /DataSet ds1 = new DataSet();/實(shí)例化dataset DataTable dt = new DataTable(); dt.Clear(); data1.Fill(dt);/把數(shù)據(jù)填充到datatable dataGridView1.DataSource = dt;/將數(shù)據(jù)集綁定datagridview,完成顯示 dataGridView1.AllowUserToAddRows = false; 后臺(tái)管理系統(tǒng):主要實(shí)現(xiàn)代碼 adminCenter.cs:private void 關(guān)于ToolStripMenuItem_Click(object sender, EventArgs e) MessageBox.Show("制作者:Matthew Hanrn完成時(shí)間:2017-6-4"); private void 退出系統(tǒng)ToolStripMenuItem_Click(object sender, EventArgs e) System.Environment.Exit(0); private void 圖書管理ToolStripMenuItem_Click(object sender, EventArgs e) editMain editMain = new editMain(); editMain.FormBorderStyle = FormBorderStyle.None; editMain.Dock = DockStyle.Fill; editMain.TopLevel = false; this.panel1.Controls.Clear(); this.panel1.Controls.Add(editMain); editMain.Show(); private void 添加圖書ToolStripMenuItem_Click(object sender, EventArgs e) edit2 edit2 = new edit2(); edit2.Show(); private void 用戶管理ToolStripMenuItem_Click(object sender, EventArgs e) edit3 edit3 = new edit3(); edit3.FormBorderStyle = FormBorderStyle.None; edit3.Dock = DockStyle.Fill; edit3.TopLevel = false; this.panel1.Controls.Clear(); this.panel1.Controls.Add(edit3); edit3.Show(); 修改圖書信息:主要實(shí)現(xiàn)代碼 editMain.cs & edit1.cs:public static string bookname; public static string bookauthor; public static string bookprice; public static string bookpress; public static string booktype;/說(shuō)明:這里用的是全局靜態(tài)變量,把表格獲取到的數(shù)據(jù)保存起來(lái),進(jìn)行數(shù)據(jù)傳輸。private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) int r = this.dataGridView1.CurrentRow.Index; string bn = this.dataGridView1.Rowsr.Cells1.Value.ToString(); string ba = this.dataGridView1.Rowsr.Cells2.Value.ToString(); string bp1 = this.dataGridView1.Rowsr.Cells3.Value.ToString(); string bp2 = this.dataGridView1.Rowsr.Cells4.Value.ToString(); string bt = this.dataGridView1.Rowsr.Cells5.Value.ToString(); / editMain editMain = new editMain(); editMain.bookname = bn.ToString(); editMain.bookauthor = ba.ToString(); editMain.bookprice = bp1.ToString(); editMain.bookpress = bp2.ToString(); editMain.booktype = bt.ToString(); / edit1 edit1 = new edit1(); edit1.Show(); /接下來(lái)是edit1.cs中的提交新的數(shù)據(jù),update數(shù)據(jù)庫(kù)。public edit1() InitializeComponent(); editMain editMain = new editMain(); label6.Text = editMain.bookname; textBox1.Text = editMain.bookauthor; textBox2.Text = editMain.bookprice; textBox3.Text = editMain.bookpress; textBox4.Text = editMain.booktype; private void button1_Click(object sender, EventArgs e) String bn = editMain.bookname; String ba = textBox1.Text; String bp1 = textBox2.Text; String bp2 = textBox3.Text; String bt = textBox4.Text; / String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open(); / String sql2 = "update bookInfo set bookAuthor = " + ba + ", bookPrice = " + bp1 + ", bookPress = " + bp2 + ",bookType = "+ bt +" where bookName = "+ bn +" " MySqlCommand cmd = new MySqlCommand(sql2, conn); int i = cmd.ExecuteNonQuery(); if (i = 1) MessageBox.Show("圖書修改成功!"); this.Hide(); 添加圖書:主要實(shí)現(xiàn)代碼 edit2.cs:private void button1_Click(object sender, EventArgs e) String bn = textBox5.Text; String ba = textBox1.Text; String bp1 = textBox2.Text; String bp2 = textBox3.Text; String bt = textBox4.Text; / String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open(); String sql2 = "insert into bookInfo(bookName,bookAuthor,bookPrice,bookPress,bookType,isBorrowed) values(" + bn + "," + ba + "," + bp1 + "," + bp2 + "," + bt + ",0) " MySqlCommand cmd = new MySqlCommand(sql2, conn); int i = cmd.ExecuteNonQuery(); if (i = 1) MessageBox.Show("圖書添加成功!"); else MessageBox.Show("系統(tǒng)出錯(cuò)!"); this.Hide(); 用戶管理:主要實(shí)現(xiàn)代碼 edit3.cs:public edit3() InitializeComponent(); String sql = "server=localhost;user id=root;password=123456;database=C#librarycenter" /根據(jù)自己的設(shè)置 MySqlConnection conn = new MySqlConnection(sql); conn.Open();/打開數(shù)據(jù)庫(kù)連接 MySqlDataAdapter data1 = new MySqlDataAdapter();/實(shí)例化sqldataadpter MySqlCommand cmd1 = new MySqlCommand("SELECT userId as 用戶ID,userName as 用戶名,(CASE userPassword WHEN null THEN * ELSE * END) as 用戶密碼,userSex as 用戶性別 FROM c#librarycenter.userInfo", conn);/sql語(yǔ)句 data1.SelectCommand = cmd1;/設(shè)置為已實(shí)例化SqlDataAdapter的查詢命令 DataTable dt = new DataTable(); dt.Clear(); data1.Fill(dt);/把數(shù)據(jù)填充到datatable dataGridView1.DataSource = dt;/將數(shù)據(jù)集綁定datagridview,完成顯示 dataGridView1.AllowUserToAddRows = false; 總結(jié)這次的圖書管理系統(tǒng),并未用到MVC設(shè)計(jì)模式,只是簡(jiǎn)單的面向?qū)ο笤O(shè)計(jì),選的題目也是比較熟悉的,本系統(tǒng)提供兩種權(quán)限:用戶和管理員,其實(shí)應(yīng)該把【管理員】分成【圖書管理員】和【系統(tǒng)管理員】,提供不同的權(quán)限,【系統(tǒng)管理員】具有對(duì)所有用戶的操作權(quán)限,【圖書管理員】具有對(duì)所有圖書的操作權(quán)限。本次課題當(dāng)然還存在著許多不足,以后有機(jī)會(huì)的話,會(huì)加以改進(jìn)。姓名:/學(xué)號(hào):/

注意事項(xiàng)

本文(C MySQL 圖書管理系統(tǒng).docx)為本站會(huì)員(小**)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!