九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

圖書管理系統(tǒng)課程設計報告.doc

上傳人:good****022 文檔編號:116524665 上傳時間:2022-07-05 格式:DOC 頁數(shù):16 大?。?64.50KB
收藏 版權申訴 舉報 下載
圖書管理系統(tǒng)課程設計報告.doc_第1頁
第1頁 / 共16頁
圖書管理系統(tǒng)課程設計報告.doc_第2頁
第2頁 / 共16頁
圖書管理系統(tǒng)課程設計報告.doc_第3頁
第3頁 / 共16頁

下載文檔到電腦,查找使用更方便

13 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《圖書管理系統(tǒng)課程設計報告.doc》由會員分享,可在線閱讀,更多相關《圖書管理系統(tǒng)課程設計報告.doc(16頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、管理信息系統(tǒng)實習報告專 業(yè) 班 級 學 生 姓 名 指 導 教 師 王 桃 群 時 間 2012.3.132012.3.23 成 績 評 語 一、課程設計題目 圖書管理系統(tǒng)二、系統(tǒng)需求1.系統(tǒng)的準備操作系統(tǒng):Windows xp數(shù)據(jù)庫系統(tǒng):SQL Server 2000 或 SQL Server 2005客戶端開發(fā)工具:Visual Studio 2005或其他開發(fā)工具2.知識準備熟悉SQL Server 2000 或 SQL Server 2005的使用;熟悉C#、ASP.NET或其他語言進行數(shù)據(jù)庫編程。3.系統(tǒng)分析圖書信息包括:每種圖書都有書名、ISBN、一名或多名作者(譯者)、出版社、定

2、價和內(nèi)容簡介等;讀者信息包括:借書證記錄有借閱者的姓名、密碼、所在單位和類別等;讀者憑借書證借書,教師最多借書15本書,借書期限最長為90天,學生最多借書8本書,借書期限最長為30天。對于超期未還的讀者不能繼續(xù)借書,每本書每超期一天罰款0.05元。三、系統(tǒng)設計1.體系結構本系統(tǒng)使用c/s模式的兩層結構,表示層(USL)和數(shù)據(jù)訪問層(DAL)。表示層(USL):為客戶提供對應用程序的訪問,以Windows應用程序或Web應用程序的形式提供實現(xiàn)的功能。業(yè)務邏輯層(BLL):實現(xiàn)應用程序的業(yè)務功能,以類庫的形式為表示層提供服務。數(shù)據(jù)訪問層(DAL):實現(xiàn)整個系統(tǒng)所有的數(shù)據(jù)庫連接、數(shù)據(jù)存取操作,以組件

3、類庫的形式為業(yè)務邏輯層提供服務。此外,實體類,簡單地說是描述一個業(yè)務實體的類。業(yè)務實體直觀一點的理解就是整個應用系統(tǒng)業(yè)務所涉及的對象,從數(shù)據(jù)存儲來講,業(yè)務實體就是存儲應用系統(tǒng)信息的數(shù)據(jù)表,將數(shù)據(jù)表中的每一個字段定義成屬性,并將這些屬性用一個類封裝,這個類就稱為實體類。2.功能模塊框圖圖 書 管 理借 書圖 書 管 理借書圖書更新圖書刪除圖書查找圖書添加3.數(shù)據(jù)庫設計1. 讀者類別表(ReaderType)字段名數(shù)據(jù)類型說明rdTypeSmallInt讀者類別【主鍵】rdTypeNameVarchar(8)讀者類別名稱CanLendQtyInt可借書數(shù)量CanLendDayInt可借書天數(shù)Can

4、ContinueTimesInt可續(xù)借的次數(shù)PunishRateFloat罰款率(分/天/本)DateValidSmallInt證書有效日期2. 讀者信息表(Reader)字段名數(shù)據(jù)類型說明rdIDInt讀者序號【主鍵】rdNamevarchar(10)讀者姓名rdPwdvarchar (10)讀者密碼,初值為“123”rdSexBit性別,0-男,1-女rdTypeSmallInt讀者類別【外鍵】rdDeptChar(8)單位代碼rdPhonevarchar(25)電話號碼rdEmailvarchar(25)電子郵件rdDateRegsmalldatetime讀者登記日期rdBorrowQt

5、yInt已借書數(shù)量3. 圖書信息表(Book)字段名數(shù)據(jù)類型說明bkIDInt圖書序號【主鍵】bkCodeChar(20)圖書編號bkNameVarchar(50)書名bkAuthorVarchar(30)作者bkPressVarchar(50)出版社bkDatePressSmalldatetime出版日期bkISBNChar(15)書號bkCatalogVarchar(30)分類名bkLanguageSmallInt語言,0-中文,1-英文,2-日文,3-俄文,4-德文,5-法文bkPagesInt頁數(shù)bkPriceMoney價格bkDateInSmallDateTime入館日期bkBrie

6、fText內(nèi)容簡介bkCoverVarchar(100) 或image圖書封面照片bkIsInLabChar(4)是否在館4. 借閱信息表(Borrow)字段名數(shù)據(jù)類型說明rdIDInt讀者序號【主鍵】bkIDInt圖書序號【主鍵】ldContinueTimesInt續(xù)借次數(shù)(第一次借時,記為1)ldDateOutSmallDateTime借書日期ldDateRetPlanSmallDateTime應還日期ldDateRetActSmallDateTime實際還書日期ldOverDayInt超期天數(shù)ldOverMoneyMoney超期金額ldPunishMoneyMoney罰款金額lsHasR

7、eturnBit是否已經(jīng)還書,缺省為0-未還OperatorLendVarChar(10)借書操作員OperatorRetVarChar(10)還書操作員四、系統(tǒng)實現(xiàn) 登錄的代碼實現(xiàn):using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace BooksMng pub

8、lic partial class BookLogin : Form public BookLogin() InitializeComponent(); private void textBox2_TextChanged(object sender, EventArgs e) private void btnlogin_Click(object sender, EventArgs e) /連接數(shù)據(jù)庫 SqlConnection conn = new SqlConnection(server=.;database=Booksmng; integrated security=True); conn

9、.Open(); SqlCommand cmd = conn.CreateCommand(); /cmd.CommandText=select count(*) from Users where userName=+txtName.Text+and userPwd=+txtPwd.Text+; cmd.CommandText = select count(*) from Users where userName=userName and userPwd=userPwd; cmd.Parameters.Add(userName, SqlDbType.VarChar, 20).Value = tx

10、tName.Text; cmd.Parameters.Add(userPwd, SqlDbType.VarChar, 20).Value = txtPwd.Text; try int count = Convert.ToInt32(cmd.ExecuteScalar(); if (count != 0) MessageBox.Show(登陸成功!); BookMain frm = new BookMain(); frm.Show(); catch (SqlException ex) /MessageBox.Show(登錄失??!); MessageBox.Show(ex.Message); pr

11、ivate void FrmLogin_Load(object sender, EventArgs e) 圖書管理部分,主要的代碼實現(xiàn)如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace BooksMng public partial class Book

12、Manage : Form public BookManage() InitializeComponent(); private void Form2_Load(object sender, EventArgs e) DataBind(); private void DataBind() /連接數(shù)據(jù)庫 SqlConnection conn = new SqlConnection(server=.; database=BooksMng;integrated security=True); /SqlConnection conn = new SqlConnection(server=.; data

13、base=BooksMng;integrated security=True); conn.Open(); SqlCommand cmd = conn.CreateCommand(); /mandText = select * from Book; cmd.CommandText = select bkID 編號, bkName 書名,bkAuthor 作者,bkPages 頁數(shù),bkPress 出版社 from Book; SqlDataAdapter sda = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sda.Fill(ds

14、); dgvBooks.DataSource = ds.Tables0; txtName.DataBindings.Clear(); txtAuthor.DataBindings.Clear(); txtPage.DataBindings.Clear(); txtPress.DataBindings.Clear(); txtName.DataBindings.Add(Text,ds.Tables0,書名); txtAuthor.DataBindings.Add(Text,ds.Tables0,作者); txtPage.DataBindings.Add(Text,ds.Tables0,頁數(shù));

15、txtPress.DataBindings.Add(Text, ds.Tables0, 出版社); /上面的代碼是在窗體Load時,將Books表中的所有記錄,即所有的圖書信息顯示在網(wǎng)格DataGrid空間中。 / /下面是實現(xiàn)添加功能 private void btnAdd_click(object sender, EventArgs e) SqlConnection conn = new SqlConnection(server=.; database=BooksMng;integrated security=True); conn.Open(); SqlCommand cmd = con

16、n.CreateCommand(); cmd.CommandText = insert into Book(bkName, bkAuthor,bkPages,bkPress) values(bkName,bkAuthor,bkPages,bkPress); cmd.Parameters.Add(bkName, SqlDbType.VarChar, 30).Value = txtName.Text; cmd.Parameters.Add(bkAuthor, SqlDbType.VarChar, 30).Value = txtAuthor.Text; cmd.Parameters.Add(bkPa

17、ges, SqlDbType.Int).Value =Convert.ToInt32(txtPage.Text);/類型轉換 cmd.Parameters.Add(bkPress, SqlDbType.VarChar, 50).Value = txtPress.Text; try cmd.ExecuteNonQuery(); /執(zhí)行上述SQL命令 MessageBox.Show(圖書添加成功!); DataBind(); /重新將數(shù)據(jù)庫綁定到DataGrid catch (SqlException ex) MessageBox.Show(圖書添加失敗); MessageBox.Show(ex.

18、Message); private void btnSearch_Click(object sender, EventArgs e) /連接數(shù)據(jù)庫 SqlConnection conn = new SqlConnection(server=.; database=BooksMng;integrated security=True); conn.Open(); SqlCommand cmd = conn.CreateCommand(); String sql = ; /按作者查找 if (txtAuthor.Text != ) sql += select bkID 編號, bkName 書名,b

19、kPages 頁數(shù),bkPress 出版社 from Book where bkAuthor=bkAuthor; try cmd.CommandText=sql; cmd.Parameters.Add(bkAuthor, SqlDbType.VarChar, 30).Value = txtAuthor.Text; SqlDataAdapter sda=new SqlDataAdapter(cmd); DataSet ds=new DataSet(); sda.Fill(ds); dgvBooks.DataSource = ds.Tables0; catch(SqlException ex) M

20、essageBox.Show(查找失敗); MessageBox.Show(ex.Message); private void btnDelete_Click(object sender, EventArgs e) /連接數(shù)據(jù)庫 SqlConnection conn = new SqlConnection(server=.; database=BooksMng;integrated security=True); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = delete from Book wher

21、e bkID=bkID; cmd.Parameters.Add(bkID, SqlDbType.Int).Value = Convert.ToInt32(dgvBooks0, dgvBooks.CurrentRow.Index.Value); try if (MessageBox.Show(確定要刪除該圖書嗎?, 確定刪除, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = DialogResult.OK) cmd.ExecuteNonQuery(); MessageB

22、ox.Show(刪除成功!); DataBind(); catch (SqlException ex) MessageBox.Show(刪除失敗); MessageBox.Show(ex.Message); /下面做更新圖書信息 private void btnUpdate_Click(object sender, EventArgs e) SqlConnection conn = new SqlConnection(server=.; database=BooksMng;integrated security=True); conn.Open(); SqlCommand cmd = conn

23、.CreateCommand(); cmd.CommandText = update Book set bkName=bkName, bkAuthor=bkAuthor, bkPages=bkPages,bkPress=bkPress where bkID=bkID; cmd.Parameters.Add(bkID, SqlDbType.Int).Value = Convert.ToInt32(dgvBooks0, dgvBooks.CurrentRow.Index.Value); cmd.Parameters.Add(bkName, SqlDbType.VarChar, 30).Value

24、= txtName.Text; cmd.Parameters.Add(bkAuthor, SqlDbType.VarChar, 30).Value =txtAuthor.Text; cmd.Parameters.Add(bkPages, SqlDbType.Int).Value = Convert.ToInt32(txtPage.Text);/類型轉換 cmd.Parameters.Add(bkPress, SqlDbType.VarChar, 50).Value = txtPress.Text; try if (MessageBox.Show(確定要更新圖書信息嗎?, 確認更新, Messa

25、geBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = DialogResult.OK) cmd.ExecuteNonQuery(); MessageBox.Show(更新成功!); DataBind(); catch (SqlException ex) MessageBox.Show(更新失敗); MessageBox.Show(ex.Message); /圖書可以添加成功借書實現(xiàn)主要代碼如下:using System;using System.Collections.Generic

26、;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace BooksMng public partial class BookBorrow : Form public BookBorrow() InitializeComponent(); /獲取讀者可借天數(shù) private int GetLendDay(int rdID) SqlConnection c

27、onn = new SqlConnection(server=.;database=BooksMng;integrated security=true); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = select CanLendDay from ReaderType where rdType=(select rdType from Reader where rdID= + rdID + ); return Convert.ToInt32(cmd.ExecuteScalar(); private vo

28、id btnBorrow_Click(object sender, EventArgs e) SqlConnection conn = new SqlConnection(server=.;database=BooksMng;integrated security=true); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = insert into Borrow(rdID,bkID,ldContinueTimes,IdDateOut,ldDateRetPlan,lsHasReturn) values(r

29、dID,bkID,0,IdDateOut,ldDateRetPlan,0); cmd.Parameters.Add(rdID, SqlDbType.Int).Value = Convert.ToInt32(txtrdID.Text); cmd.Parameters.Add(bkID, SqlDbType.Int).Value = Convert.ToInt32(txtbkID.Text);/類型轉換 cmd.Parameters.Add(IdDateOut, SqlDbType.DateTime).Value = DateTime.Now;/借書時間為當前的系統(tǒng)時間 /應還日期為=借書日期+可

30、借天數(shù)cmd.Parameters.Add(ldDateRetPlan, SqlDbType.DateTime).Value = DateTime.Now.AddDays(GetLendDay(Convert.ToInt32(txtrdID.Text); try cmd.ExecuteNonQuery(); MessageBox.Show(借書成功!); catch (SqlException ex) MessageBox.Show(借書失敗); MessageBox.Show(ex.Message); 五、系統(tǒng)運行效果 圖書管理模塊的運行結果如下:首先,設計一個用戶登錄界面,以管理員的身份登

31、錄來實現(xiàn)圖書的添加、查找、刪除、更新的功能。 登錄界面的設計:登錄成功的效果登錄成功以后,跳到圖書管理主界面:圖書管理主界面如下:登錄成功以后,跳到圖書管理的頁面:圖書管理的頁面如下: 此界面可以對圖書實現(xiàn)添加、查找、刪除和信息更新這四個功能。從圖書管理主界面跳到借書界面:六、遇到的問題及解決方法 在實現(xiàn)借書這個功能時,老是借書失敗,并且提示: 憑借這個提示是不可能找到錯誤的,為了找到這個錯誤,我設置了一個斷點如圖: 然后逐句運行,發(fā)現(xiàn)錯誤在 “catch (SqlException ex)”這句,并且提示:點擊獲取錯誤的幫助,軟件給出的幫助是:我不知道這是什么錯誤,但是我知道錯誤不在“cat

32、ch (SqlException ex)”這句,因為每當執(zhí)行“cmd.ExecuteNonQuery();”這句時,就會跳到“catch (SqlException ex)”這句,并且提示有錯誤。我上網(wǎng)搜索了“cmd.ExecuteNonQuery();”此語句,發(fā)現(xiàn)有這么一段解釋: cmd.Parameters.Add(New OleDbParameter(用戶名, OleDbType.VarChar) 首先你的insertinto這個SQL語句是錯誤的,應該是insert into Enternumber(username,password,sex,work,tel,mail) value

33、s (用戶名,密碼,性別,職業(yè),電話,郵箱) 其次就是最關鍵的錯誤,parameters這個方法使用時一定要有這樣一個語句mandtypeCommandType.StoredProcedure這個語句的作用是用存儲方法來傳值的,也就是說在你的數(shù)據(jù)庫中一定要一個存儲過程, parameters方法的使用前面應該有,mandtype=commandtype.storedprocedure mandtext=存儲過程 cmd.parameters.add(new oledbparameter(存儲變量的一個變量名,數(shù)值) 此時我終于知道了,是數(shù)據(jù)庫插入于具有問題,經(jīng)過我反復的比較數(shù)據(jù)庫中的各個鍵的屬

34、性,左最終改掉了所有的錯誤,程序運行正確。七、心得與體會這次的課程設計主要使用c#和SQL Server這兩種知識來設計一個圖書管理系統(tǒng),而對于這兩種知識我們曾經(jīng)都開了課程,并且進行了系統(tǒng)的學習。我曾經(jīng)自認為SQL Server還學得不錯,因為書上的東西差不多都弄懂了,然而這次課程設計我卻發(fā)現(xiàn)書上的東西我?guī)缀跬貌畈欢嗔?,一個很簡單的查詢語句都不知道怎么去寫。我恍然間發(fā)覺自己做的很差,對于已經(jīng)學的東西沒有很好地進行運用,以至于很多已經(jīng)學了的東西都已經(jīng)忘記了。雖然如此,但老師仍很耐心的給我們講解,知道我們?nèi)绾我徊揭徊降厝プ?,真的很感謝老師為我們的付出。通過這兩個星期的課程設計,是我對所學知識有了更深一步的理解與掌握,理論與實踐也能更好地結合在一起,這一過程中我遇到了很多困難,但這更使我覺得其中的樂趣和那種戰(zhàn)勝困難后的成就感。同時感到學無止境,在今后的學習和工作中,我會不斷地充實自己。

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關資源

更多
正為您匹配相似的精品文檔
關于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

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

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


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