图书馆管理系统源代码_第1页
图书馆管理系统源代码_第2页
图书馆管理系统源代码_第3页
图书馆管理系统源代码_第4页
图书馆管理系统源代码_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 源程序清单 1 文件名 login login frm 功能说明 整个系统的登陆界面 需要输入用户名和登陆密码才能进入到 系统中 进行借阅等操作 源代码 Option Explicit Dim cnt As Integer Private Sub Command1 Click Dim sql As String Dim rs login As New ADODB Recordset If Trim Combo1 Text Then MsgBox 没有这个用户 vbOKOnly vbExclamation Combo1 SetFocus Else sql select from 系统管理 where 用户名 data source book mdb conn Open connectionstring cnt 0 End Sub Private Sub txtuser Change End Sub 2 文件名 form1 form1 frm 功能说明 整个系统的主界面 其中包括图书管理 读者管理 图书借阅 管理 系统管理 关于 以及在这下面的子菜单 源代码 Private Sub add admin Click frmadduser Show End Sub Private Sub add back book Click frmbackbookinfo Show 3 End Sub Private Sub add book info Click frmaddbookinfo Show End Sub Private Sub add book style Click frmaddbookstyle Show End Sub Private Sub add lend book Click frmfindbook Show End Sub Private Sub add reader info Click frmaddreaderinfo Show End Sub Private Sub add reader style Click frmaddreaderstyle Show End Sub Private Sub change pwd Click frmchangepwd Show End Sub Private Sub del book info Click frmmodifybookinfo Show End Sub Private Sub del book style Click frmmodifybookstyle Show End Sub Private Sub del reader info Click frmreaderinfo Show End Sub Private Sub del reader style Click 4 frmmodifyreaderstyle Show End Sub Private Sub exit sys Click End End Sub Private Sub find book info Click frmfindbook Show End Sub Private Sub find lend book Click frmfindborrowinfo Show End Sub Private Sub find reader info Click frmfindreader Show End Sub Private Sub Form Load End Sub Private Sub gly Click Form2 Show End Sub Private Sub modify book info Click frmmodifybookinfo Show End Sub Private Sub modify book style Click frmmodifybookstyle Show End Sub Private Sub modify reader info Click frmreaderinfo Show End Sub Private Sub modify reader style Click 5 frmmodifyreaderstyle Show End Sub 3 文件名 frmaddbookstyle frmbookstyle frm 功能说明 用于添加图书类别信息 源代码 Option Explicit Private Sub Command1 Click Dim rs bookstyle As New ADODB Recordset Dim sql As String If Trim Text1 Text Then MsgBox 图书种类不能为空 vbOKOnly vbExclamation Text1 SetFocus Exit Sub End If If Trim Text2 Text Then MsgBox 种类编号不能为空 vbOKOnly vbExclamation Text2 SetFocus Exit Sub End If sql select from 图书类别 where 类别名称 Text1 Text rs bookstyle Open sql conn adOpenKeyset adLockPessimistic If rs bookstyle EOF Then rs bookstyle AddNew rs bookstyle Fields 0 Trim Text1 Text rs bookstyle Fields 1 Trim Text2 Text rs bookstyle Update MsgBox 添加图书类别成功 vbOKOnly rs bookstyle Close Else 6 MsgBox 读者类别重复 vbOKOnly vbExclamation Text1 SetFocus Text1 Text rs bookstyle Close Exit Sub End If End Sub Private Sub Command2 Click Unload Me End Sub 4 文件名 frmmodifybookstyle code 功能说明 图书类别管理 可以修改和删除图书类别 源代码 Option Explicit Dim rs reader As New ADODB Recordset Private Sub cmdcancel Click rs reader CancelUpdate DataGrid1 Refresh DataGrid1 AllowAddNew False DataGrid1 AllowUpdate False cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False End Sub Private Sub cmddel Click Dim answer As String On Error GoTo delerror answer MsgBox 确定要删除吗 vbYesNo 7 If answer vbYes Then DataGrid1 AllowDelete True rs reader Delete rs reader Update DataGrid1 Refresh MsgBox 成功删除 vbOKOnly vbExclamation DataGrid1 AllowDelete False Else Exit Sub End If delerror If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub cmdmodify Click Dim answer As String On Error GoTo cmdmodify cmddel Enabled False cmdmodify Enabled False cmdupdate Enabled True cmdcancel Enabled True DataGrid1 AllowUpdate True cmdmodify If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub Command5 Click 8 rs reader Update DataGrid1 Refresh End Sub Private Sub cmdupdate Click If Not IsNull DataGrid1 Bookmark Then rs reader Update End If cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False DataGrid1 AllowUpdate False MsgBox 保存成功 vbOKOnly vbExclamation End Sub Private Sub Command1 Click Unload Me End Sub Private Sub Form Load Dim sql As String On Error GoTo loaderror sql select from 图书类别 rs reader CursorLocation adUseClient rs reader Open sql conn adOpenKeyset adLockPessimistic 打开数 据库 cmdupdate Enabled False 设定 datagrid 控件属性 DataGrid1 AllowAddNew False 不可增 加 9 DataGrid1 AllowDelete False 不可删 除 DataGrid1 AllowUpdate False If userpow guest Then 权限相 关 Frame2 Enabled False End If Set DataGrid1 DataSource rs reader Exit Sub loaderror MsgBox Err Description End Sub 5 文件名 frmaddbookinfo frmaddbookinfo frm 功能说明 添加图书信息 包括图书编号 书名 出版日期 入库日期 作者等信息 源代码 Option Explicit Private Sub Command1 Click Dim rs addbook As New ADODB Recordset Dim sql As String If Trim Combo1 Text Then MsgBox 请选择图书种类 vbOKOnly vbExclamation Combo1 SetFocus Exit Sub End If If Trim Text1 Text Then MsgBox 图书编号不能为空 vbOKOnly vbExclamation Text1 SetFocus Exit Sub 10 End If If Trim Text2 Text Then MsgBox 书名不能为空 vbOKOnly vbExclamation Text2 SetFocus Exit Sub End If If Not IsDate Text5 Text Then MsgBox 请按照 yyyy mm dd 格式输入日期 vbOKOnly vbExclamation Text5 SetFocus Exit Sub End If If Not IsDate Text6 Text Then MsgBox 请按照 yyyy mm dd 格式输入日期 vbOKOnly vbExclamation Text6 SetFocus Exit Sub End If sql select from 书籍信息 where 书籍编号 Text1 Text rs addbook Open sql conn adOpenKeyset adLockPessimistic If rs addbook EOF Then rs addbook AddNew rs addbook Fields 0 Trim Text1 Text rs addbook Fields 1 Trim Text2 Text rs addbook Fields 2 Trim Combo1 Text rs addbook Fields 3 Trim Text3 Text rs addbook Fields 4 Trim Text4 Text rs addbook Fields 5 Trim Text5 Text 11 rs addbook Fields 6 Trim Text6 Text rs addbook Fields 7 否 rs addbook Update MsgBox 添加书籍信息成功 vbOKOnly rs addbook Close Else MsgBox 图书编号重复 vbOKOnly vbExclamation Text1 SetFocus Text1 Text rs addbook Close Exit Sub Private Sub Form Load Dim rs leibie As New ADODB Recordset Dim sql As String sql select from 图书类别 rs leibie Open sql conn adOpenKeyset adLockPessimistic rs leibie MoveFirst Do While Not rs leibie EOF Combo1 AddItem rs leibie Fields 0 rs leibie MoveNext Loop rs leibie Close End Sub Private Sub Frame1 DragDrop Source As Control X As Single Y As Single End Sub 6 文件名 frmfindbook form 功能说明 查询图书信息 可以选择性的输入图书的编号 名称或者类别 查询图书的详细信息 12 源代码 Option Explicit Dim panduan As String Private Sub Command1 Click Dim rs findbook As New ADODB Recordset Dim sql As String If Check1 Value vbChecked Then sql 书名 Trim Text1 Text End If If Check2 Value vbChecked Then If Trim sql Then sql 类别 Trim Combo1 Text Else sql sql and 书名 Trim Combo1 Text End If End If If Check3 Value vbChecked Then If Trim sql Then sql 作者 Trim Text2 Text Else sql sql and 作者 Trim Text2 Text End If End If If Check4 Value vbChecked Then If Trim sql Then sql 出版社 Trim Text3 Text Else sql sql and 出版社 Trim Text3 Text End If 13 End If If Check5 Value vbChecked Then If Trim sql Then sql 书籍编号 Trim Text4 Text Else sql sql and 书籍编号 Trim Text4 Text End If End If If Trim sql Then MsgBox 请选择查询方式 vbOKOnly vbExclamation Exit Sub End If sql select from 书籍信息 where sql rs findbook CursorLocation adUseClient rs findbook Open sql conn adOpenKeyset adLockPessimistic DataGrid1 AllowAddNew False DataGrid1 AllowDelete False DataGrid1 AllowUpdate False Set DataGrid1 DataSource rs findbook rs findbook Close End Sub Private Sub Command2 Click Unload Me End Sub Private Sub Command3 Click If Trim book num Then MsgBox 请选择要借阅的图书 vbOKOnly vbExclamation Exit Sub 14 End If If panduan 是 Then MsgBox 此书已被借出 vbOKOnly vbExclamation Exit Sub End If frmborrowbook Show End Sub Private Sub DataGrid1 RowColChange LastRow As Variant ByVal LastCol As Integer book num DataGrid1 Columns 0 CellValue DataGrid1 Bookmark panduan DataGrid1 Columns 7 CellValue DataGrid1 Bookmark End Sub Private Sub Form Load Dim rs find As New ADODB Recordset Dim sql As String sql select from 图书类别 rs find Open sql conn adOpenKeyset adLockPessimistic rs find MoveFirst If Not rs find EOF Then Do While Not rs find EOF Combo1 AddItem rs find Fields 0 rs find MoveNext Loop Combo1 ListIndex 0 End If rs find Close End Sub 7 文件名 frmaddreaderstyle frmaddreaderstyle frm 功能说明 添加读者的类别 15 源代码 Option Explicit Dim rs readerstyle As New ADODB Recordset Private Sub Command1 Click Dim sql As String If Trim Text1 Text Then MsgBox 读者种类不能为空 vbOKOnly vbExclamation Text1 SetFocus Exit Sub End If If Trim Text2 Text Then MsgBox 借书数量不能为空 vbOKOnly vbExclamation Text2 SetFocus Exit Sub End If If Trim Text3 Text Then MsgBox 借书期限不能为空 vbOKOnly vbExclamation Text3 SetFocus Exit Sub End If If Trim Text4 Text Then MsgBox 有限期限不能为空 vbOKOnly vbExclamation Text4 SetFocus Exit Sub End If sql select from 读者类别 where 种类名称 Text1 Text rs readerstyle Open sql conn adOpenKeyset adLockPessimistic If rs readerstyle EOF Then 16 rs readerstyle AddNew rs readerstyle Fields 0 Trim Text1 Text rs readerstyle Fields 1 CInt Text2 Text rs readerstyle Fields 2 CInt Text3 Text rs readerstyle Fields 3 CInt Text4 Text rs readerstyle Update MsgBox 添加读者类别成功 vbOKOnly rs readerstyle Close Text1 Text2 Text3 Text4 Else MsgBox 读者类别重复 vbOKOnly vbExclamation Text1 SetFocus Text1 Text rs readerstyle Close Exit Sub End If End Sub 8 文件名 frmmodifyreaderstyle form 功能说明 读者类别管理 可以查询 删除 修改读者的信息 源代码 Option Explicit Dim rs reader As New ADODB Recordset Private Sub cmdcancel Click rs reader CancelUpdate DataGrid1 Refresh DataGrid1 AllowAddNew False 17 DataGrid1 AllowUpdate False cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False End Sub Private Sub cmddel Click Dim answer As String On Error GoTo delerror answer MsgBox 确定要删除吗 vbYesNo If answer vbYes Then DataGrid1 AllowDelete True rs reader Delete rs reader Update DataGrid1 Refresh MsgBox 成功删除 vbOKOnly vbExclamation DataGrid1 AllowDelete False Else Exit Sub End If delerror If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub cmdmodify Click Dim answer As String On Error GoTo cmdmodify cmddel Enabled False 18 cmdmodify Enabled False cmdupdate Enabled True cmdcancel Enabled True DataGrid1 AllowUpdate True cmdmodify If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub Command5 Click rs reader Update DataGrid1 Refresh End Sub Private Sub cmdupdate Click If Not IsNull DataGrid1 Bookmark Then rs reader Update End If cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False DataGrid1 AllowUpdate False MsgBox 保存成功 vbOKOnly vbExclamation End Sub Private Sub Command1 Click Unload Me End Sub Private Sub Form Load Dim sql As String 19 On Error GoTo loaderror sql select from 读者类别 rs reader CursorLocation adUseClient rs reader Open sql conn adOpenKeyset adLockPessimistic 打开数 据库 cmdupdate Enabled False 设定 datagrid 控件属性 DataGrid1 AllowAddNew False 不可增 加 DataGrid1 AllowDelete False 不可删 除 DataGrid1 AllowUpdate False If userpow guest Then 权限相 关 Frame2 Enabled False End If Set DataGrid1 DataSource rs reader cmdcancel Enabled False Exit Sub loaderror MsgBox Err Description End Sub Private Sub Form Unload Cancel As Integer Set DataGrid1 DataSource Nothing rs reader Close End Sub 9 文件名 frmaddreaderinfo frmaddreaderinfo frm 功能说明 添加读者信息 包括读者的姓名 性别 读者类别 登记日期 电话号码 工作单位 家庭地址等信息 20 源代码 Option Explicit Dim rs addreader As New ADODB Recordset Private Sub Command1 Click Dim sql As String If Trim Combo1 Text Then MsgBox 请选择读者种类 vbOKOnly vbExclamation Combo1 SetFocus Exit Sub End If If Trim Text1 Text Then MsgBox 读者姓名不能为空 vbOKOnly vbExclamation Text1 SetFocus Exit Sub End If If Trim Text2 Text Then MsgBox 读者编号不能为空 vbOKOnly vbExclamation Text2 SetFocus Exit Sub End If sql select from 读者信息 where 读者编号 Text2 Text rs addreader Open sql conn adOpenKeyset adLockPessimistic If rs addreader EOF Then rs addreader AddNew rs addreader Fields 0 Trim Text1 Text rs addreader Fields 1 Trim Text2 Text rs addreader Fields 2 Trim Combo2 Text rs addreader Fields 3 Trim Combo1 Text 21 rs addreader Fields 4 Trim Text3 Text rs addreader Fields 5 Trim Text4 Text rs addreader Fields 6 Trim Text5 Text rs addreader Fields 7 CDate Text6 Text rs addreader Update MsgBox 添加读者信息成功 vbOKOnly rs addreader Close Text1 Text2 Text3 Text4 Text5 Text6 Else MsgBox 读者编号重复 vbOKOnly vbExclamation Text1 SetFocus Text1 Text rs addreader Close Exit Sub End If End Sub Private Sub Command2 Click Unload Me End Sub Private Sub Form Load Combo2 AddItem 男 Combo2 AddItem 女 Dim rs leibie As New ADODB Recordset 22 Dim sql As String sql select from 读者类别 rs leibie Open sql conn adOpenKeyset adLockPessimistic rs leibie MoveFirst Do While Not rs leibie EOF Combo1 AddItem rs leibie Fields 0 rs leibie MoveNext Loop rs leibie Close End Sub 10 文件名 frmreaderinfo frmreaderinfo frm 功能说明 读者信息管理 可以修改和删除读者的信息 源代码 Option Explicit Dim rs reader As New ADODB Recordset Private Sub cmdcancel Click rs reader CancelUpdate DataGrid1 Refresh DataGrid1 AllowAddNew False DataGrid1 AllowUpdate False cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False End Sub Private Sub cmddel Click Dim answer As String On Error GoTo delerror answer MsgBox 确定要删除吗 vbYesNo 23 If answer vbYes Then DataGrid1 AllowDelete True rs reader Delete rs reader Update DataGrid1 Refresh MsgBox 成功删除 vbOKOnly vbExclamation DataGrid1 AllowDelete False Else Exit Sub End If delerror If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub cmdmodify Click Dim answer As String On Error GoTo cmdmodify cmddel Enabled False cmdmodify Enabled False cmdupdate Enabled True cmdcancel Enabled True DataGrid1 AllowUpdate True cmdmodify If Err Number 0 Then MsgBox Err Description End If End Sub Private Sub Command5 Click 24 rs reader Update DataGrid1 Refresh End Sub Private Sub cmdupdate Click If Not IsNull DataGrid1 Bookmark Then rs reader Update End If cmdmodify Enabled True cmddel Enabled True cmdcancel Enabled False cmdupdate Enabled False DataGrid1 AllowUpdate False MsgBox 保存成功 vbOKOnly vbExclamation End Sub Private Sub Command1 Click Unload Me End Sub Private Sub Form Load Dim sql As String On Error GoTo loaderror sql select from 读者信息 rs reader CursorLocation adUseClient rs reader Open sql conn adOpenKeyset adLockPessimistic 打开数据库 cmdupdate Enabled False 设定 datagrid 控件属性 DataGrid1 AllowAddNew False 不可增加 25 DataGrid1 AllowDelete False 不可删除 DataGrid1 AllowUpdate False If userpow guest Then 权限相关 Private Sub Form Unload Cancel As Integer Set DataGrid1 DataSource Nothing rs reader Close End Sub 11 文件名 frmfindreader frmfindreader frm 功能说明 查询读者信息 可以选择性的输入读者姓名 读者编号 读者 种类来查询读者的详细信息 源代码 Option Explicit Private Sub Command1 Click Dim rs findreader As New ADODB Recordset Dim sql As String If Check1 Value vbChecked Then sql 读者编号 Trim Text1 Text End If If Check2 Value vbChecked Then If Trim sql Then sql 读者姓名 Trim Text2 Text Else sql sql and 读者姓名 Trim Text2 Text End If End If If Check3 Value vbChecked Then 26 If Trim sql Then sql 读者类别 Trim Combo1 Text Else sql sql and 读者类别 Trim Combo1 Text End If End If sql select from 读者信息 where sql rs findreader CursorLocation adUseClient rs findreader Open sql conn adOpenKeyset adLockPessimistic DataGrid1 AllowAddNew False DataGrid1 AllowDelete False DataGrid1 AllowUpdate False Set DataGrid1 DataSource rs findreader End Sub Private Sub Command2 Click Unload Me End Sub Private Sub Form Load Dim rs find As New ADODB Recordset Dim sql As String sql select from 读者类别 rs find Open sql conn adOpenKeyset adLockPessimistic If Not rs find EOF Then Do While Not rs find EOF Combo1 AddItem rs find Fields 0 rs find MoveNext Loop Combo1 ListIndex 0 27 End If rs find Close End Sub 12 文件名 frmfindborrowinfo frmfindborrowinfo frm 功能说明 查询借书信息 可以查询到已借出的书 未借出的图书 源代码 Option Explicit Private Sub Command1 Click Dim sql As String Dim rs find As New ADODB Recordset If Option1 Value True Then sql select from 书籍信息 where 是否被借出 是 End If If Option2 Value True Then sql select from 书籍信息 where 是否被借出 否 End If If Option3 Value True Then sql select from 借阅信息 where 读者姓名 Text1 Text End If rs find CursorLocation adUseClient rs find Open sql conn adOpenKeyset adLockPessimistic DataGrid1 AllowAddNew False DataGrid1 AllowDelete False DataGrid1 AllowUpdate False Set DataGrid1 DataSource rs find End Sub 13 文件名 frmbackbookinfo frmbackbookinfo frm 28 功能说明 添加还书信息 可以通过读者编号 读者姓名 图书编号 图 书名称等查询到已借出的书 源代码 Option Explicit Dim findform As Boolean Private Sub Combo1 Click Combo2 ListIndex Combo1 ListIndex End Sub Private Sub Command1 Click Dim rs reader As New ADODB Recordset Dim sql As String findform True sql select from 借阅信息 where 读者姓名 Combo2 Text rs reader CursorLocation adUseClient rs reader Open sql conn adOpenKeyset adLockPessimistic Set DataGrid1 DataSource rs reader DataGrid1 AllowAddNew

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论