图书管理系统》系统设计报告
第十小组
一、 引言
1. 摘要:中学图书馆管理系统
目的:方便图书馆对书籍借阅的管理
主要功能: —学生基本信息查询
—书籍借阅管理
—书籍管理
2. 背景:第十小组承担开发任务
3. 工作条件与限制:windows操作平台,Visual Basic6.0和SQL Sserver2000等软件为开发工具,利用上课时间和课外时间做成。由于现在图书管理系统已经比叫完善,所以我们暂时没有能做出比以前有先进技术的管理系统。
4. 参考和引用资料:《数据库系统概论》,VB应用
5. 专门术语定义:
二、系统总体技术方案
1. 计算机系统配置:windows平台,VB/SqlServer2000,WINNT SERVER操作系统, SQL server2000关系数据库管理系统 ,VB操作软件,局域网。
2. 模块设计:主要分为三个模块:即学生基本信息模块,书籍借阅模块,书籍管理模块
代码设计:读者信息查询
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 "请选择查询关键字!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(txtKey.Text) = "" Then
MsgBox "请设置查询关键字的值!", 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
图书馆详细信息
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()