《圖書管理系統(tǒng)》系統(tǒng)設(shè)計報告
圖書管理系統(tǒng)系統(tǒng)設(shè)計報告一、 引言 1 摘要:中學(xué)圖書館管理系統(tǒng) 目的:方便圖書館對書籍借閱的管理 主要功能: 學(xué)生基本信息查詢 書籍借閱管理 書籍管理 2 背景:第十小組承擔(dān)開發(fā)任務(wù) 3 工作條件與限制:windows操作平臺,Visual Basic6.0和SQL Sserver2000等軟件為開發(fā)工具,利用上課時間和課外時間做成。由于現(xiàn)在圖書管理系統(tǒng)已經(jīng)比叫完善,所以我們暫時沒有能做出比以前有先進技術(shù)的管理系統(tǒng)。 4 參考和引用資料:數(shù)據(jù)庫系統(tǒng)概論,VB應(yīng)用 5 專門術(shù)語定義: 二、系統(tǒng)總體技術(shù)方案 1 計算機系統(tǒng)配置:windows平臺,VB/SqlServer2000,WINNT SERVER操作系統(tǒng), SQL server2000關(guān)系數(shù)據(jù)庫管理系統(tǒng) ,VB操作軟件,局域網(wǎng)。 2 模塊設(shè)計:主要分為三個模塊:即學(xué)生基本信息模塊,書籍借閱模塊,書籍管理模塊 代碼設(shè)計:讀者信息查詢 Public connStr As ADODB.Connection Private Sub Command1_Click() End Sub Private Sub cmdAdd_Click() If Trim(List1.Text) <> "" Then List2.AddItem (List1.Text) End If End Sub Private Sub cmdMove_Click() If Trim(List2.Text) <> "" Then List2.RemoveItem (List2.ListIndex) End If End Sub Private Sub cmdSearch_Click() Dim cmdstr As String If List2.ListCount = 0 Then MsgBox "請選擇輸出列!", vbOKOnly, "提示" Exit Sub End If cmdstr = "select " For i = 0 To List2.ListCount - 1 If Trim(List2.List(i) = "圖書證號" Then cmdstr = cmdstr + "READER_DATA." + Trim(List2.List(i) + "," Else If Trim(List2.List(i) = "書號" Then cmdstr = cmdstr + "MARC_DATA." + Trim(List2.List(i) + "," Else cmdstr = cmdstr + Trim(List2.List(i) + "," End If End If Next cmdstr = Left(cmdstr, Len(cmdstr) - 1) If Opbook.Value = True Then cmdstr = cmdstr + " from MARC_DATA where " End If If Opreader.Value = True Then cmdstr = cmdstr + " from READER_DATA where " End If If Oplend.Value = True Then cmdstr = cmdstr + " from MARC_DATA,READER_DATA,LEND_DATA " & " where MARC_DATA.書號=LEND_DATA. 書號 and " & " READER_DATA.圖書證號=LEND_DATA.圖書證號 and " End If If Trim(comKey.Text) = "" Then MsgBox "請選擇查詢關(guān)鍵字!", vbOKOnly, "提示" Exit Sub End If If Trim(txtKey.Text) = "" Then MsgBox "請設(shè)置查詢關(guān)鍵字的值!", vbOKOnly, "提示" Exit Sub End If If ComType.Text = "精確匹配" Then cmdstr = cmdstr + Trim(comKey.Text) + "=" + Trim(txtKey.Text) + "" Else cmdstr = cmdstr + Trim(comKey.Text) + " like " + Trim(txtKey.Text) + "%" End If Adodc1.RecordSource = cmdstr Adodc1.Refresh DataGrid1.Refresh End Sub Private Sub Form_Load() Set connStr = New ADODB.Connection connStr.Open "driver=SQL Server; Server=SYSLAB000;UID=jj138;PWD=;database=計教(1)班38號" Adodc1.ConnectionString = connStr ComType.AddItem ("精確匹配") ComType.AddItem ("前方一致匹配") End Sub Private Sub Label3_Click() End Sub Private Sub List2_Click() End Sub Private Sub Opbook_Click() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open "MARC_DATA", connStr, adOpenKeyset, adLockReadOnly, adCmdTable comKey.Clear List1.Clear For i = 0 To rs.Fields.Count - 1 comKey.AddItem (rs.Fields(i).Name) List1.AddItem (rs.Fields(i).Name) Next rs.Close List2.Clear txtKey.Text = "" End Sub Private Sub Oplend_Click() comKey.Clear List1.Clear comKey.AddItem ("圖書證號") comKey.AddItem ("姓名") comKey.AddItem ("書號") comKey.AddItem ("書名") comKey.AddItem ("出版社") comKey.AddItem ("借出日期") comKey.AddItem ("還書日期") List1.AddItem ("圖書證號") List1.AddItem ("姓名") List1.AddItem ("書號") List1.AddItem ("書名") List1.AddItem ("出版社") List1.AddItem ("借出日期") List1.AddItem ("還書日期") List2.Clear txtKey.Text = "" End Sub Private Sub Opreader_Click() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open "READER_DATA", connStr, adOpenKeyset, adLockReadOnly, adCmdTable comKey.Clear List1.Clear For i = 0 To rs.Fields.Count - 1 comKey.AddItem (rs.Fields(i).Name) List1.AddItem (rs.Fields(i).Name) Next rs.Close List2.Clear txtKey.Text = "" End Sub 借還書處理 Private Sub cmdLend_Click() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset If Trim(txtBid.Text) = "" Or Trim(txtRid_1.Text) = "" Then MsgBox "請輸入圖書證號和書號!", vbOKOnly, "提示信息" Else rs.Open "LEND_DATA", connStr, adOpenKeyset, adLockOptimistic, adCmdTable rs.AddNew rs("書號") = txtBid.Text rs("借出日期") = Date rs("圖書證號") = txtRid.Text rs.Update Adodc1.Refresh End If End Sub Private Sub cmdReturn_Click() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset If Trim(txtBid.Text) = "" Or Trim(txtRid_1.Text) = "" Then MsgBox "請輸入圖書證號和書號!", vbOKOnly, "提示信息" Else cmdstr = "update LEND_DATA set 還書日期=" _ & Date & " where 書號=" & Trim(txtBid.Text) & "" rs.Open cmdstr, connStr, adOpenKeyset, adLockOptimistic, adCmdText Adodc1.Refresh End If End Sub Private Sub cmds_Click() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset cmdstr = "select * from READER_DATA WHERE 圖書證號 =" & Trim(txtRid_1.Text) & "" rs.Open cmdstr, connStr, adOpenForwardOnly, adLockReadOnly, adCmdText If Not rs.EOF Then txtRid.Text = rs("圖書證號") txtName.Text = rs("姓名") If Not IsNull(rs("性別") Then txtXb.Text = rs("性別") End If If Not IsNull(rs("系名") Then txtXm.Text = rs("系名") End If Else MsgBox "未找到該讀者信息!", vbOKOnly, "提示信息" End If cmdstr = "select 借出日期,還書日期,LEND_DATA.書號,書名,作者,出版社" & " from LEND_DATA,MARC_DATA " & "where LEND_DATA.書號=MARC_DATA.書號 and " & " 還書日期 is null and 圖書證號=" & Trim(txtRid_1.Text) & "" Adodc1.RecordSource = cmdstr Adodc1.Refresh End Sub Private Sub cmdSearch_Click() cmdstr = "select 借出日期,還書日期,LEND_DATA.書號,書名,作者,出版社" & "from LEND_DATA,MARC_DATA " & "where LEND_DATA.書號=MARC_DATA.書號 and 圖書證號=" & Trim(txtRid_1.Text) & "" Adodc1.RecordSource = cmdstr Adodc1.Refresh End Sub Private Sub DataGrid1_Click() If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.BOF Then txtBid.Text = Adodc1.Recordset("書號") End If End Sub Private Sub Form_Load() Set connStr = New ADODB.Connection connStr.Open "driver=SQL Server; Server=SYSLAB000;UID=jj138;PWD=;database=計教(1)班38號" Adodc1.ConnectionString = connStr End Sub 圖書館詳細(xì)信息 Private Sub txt_refresh() If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then txtBid.Text = Adodc1.Recordset("書號") txtBname.Text = Adodc1.Recordset("書名") txtWrite.Text = Adodc1.Recordset("作者") txtPublisher.Text = Adodc1.Recordset("出版社") txtYear.Text = Adodc1.Recordset("出版時間") txtGb.Text = Adodc1.Recordset("國別代碼") txtDate.Text = Adodc1.Recordset("進館時間") txtCallno.Text = Adodc1.Recordset("分類號") End If End Sub Private Sub cmdDele_Click() Dim deletxt As String deletxt = "是否刪除圖書" & Adodc1.Recordset("書名") & "的記錄?" If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then If MsgBox(deletxt, vbOKCancel, "提示信息") = vbOK Then Adodc1.Recordset.Delete Adodc1.Refresh End If End If End Sub Private Sub cmdNew_Click() If cmdNew.Caption = "新增" Then txt_enable (2) cmdNew.Caption = "保存" txtBid.Text = "" txtBname.Text = "" txtWrite.Text = "" txtPublisher.Text = "" txtYear.Text = "" txtGb.Text = "" txtDate.Text = "" txtCallno.Text = "" Else Adodc1.Recordset.AddNew Adodc1.Recordset("書號") = Trim(txtBid.Text) Adodc1.Recordset("書名") = Trim(txtBname.Text) Adodc1.Recordset("作者") = Trim(txtWrite.Text) Adodc1.Recordset("出版社") = Trim(txtPublisher.Text) Adodc1.Recordset("出版時間") = Trim(txtYear.Text) Adodc1.Recordset("國別代碼") = Trim(txtGb.Text) 4 Adodc1.Recordset("進館時間") = Trim(txtDate.Text) Adodc1.Recordset("分類號") = Trim(txtCallno.Text) Adodc1.Recordset.UpdateBatch Adodc1.Refresh txt_enable (1) cmdNew.Caption = "新增" Adodc1.Recordset.MoveFirst txt_refresh End If Private Sub cmdNext_Click() If Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveNext txt_refresh End If End Sub Private Sub cmdPre_Click() If Not Adodc1.Recordset.BOF Then Adodc1.Recordset.MovePrevious txt_refresh 2 End If End Sub Private Sub cmdUpdate_Click() If cmdUpdate.Caption = "修改" Then txt_enable (2) cmdUpdate.Caption = "保存" Else Adodc1.Recordset("書號") = Trim(txtBid.Text) Adodc1.Recordset("書名") = Trim(txtBname.Text) Adodc1.Recordset("作者") = Trim(txtWrite.Text) Adodc1.Recordset("出版社") = Trim(txtPublisher.Text) Adodc1.Recordset("出版時間") = Trim(txtYear.Text) Adodc1.Recordset("國別代碼") = Trim(txtGb.Text) Adodc1.Recordset("進館時間") = Trim(txtDate.Text) Adodc1.Recordset("分類號") = Trim(txtCallno.Text) Adodc1.Recordset.UpdateBatch Adodc1.Refresh txt_enable (1) cmdUpdate.Caption = "修改" End If End Sub Private Sub Form_Load() txt_refresh End Sub Private Sub Text1_Change() End Sub Private Sub Text8_Change() End Sub Private Sub txtBname_Change() End Sub