《数据库图书借阅管理系统本科论文.doc》由会员分享,可在线阅读,更多相关《数据库图书借阅管理系统本科论文.doc(24页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、目录(1)设计目的 (2)(2)设计要求 设计和实验报告要求 (2)(3)设计方法 系统功能 (3)(4)总体设计 模块功能说明和源程序 (3)(5)调试与测试 (14)调试方法,测试结果的分析与讨论,测试过程中遇到的主要问题及采取的解决措施(6)实验总结 (15) 1.设计目的:1、目的: (1)要求学生达到熟练掌握SQL数据库的基本知识和技能; (2)基本掌握数据库程序设计的基本思路和方法; (3)能够利用所学的基本知识和技能,解决简单的程序设计问题。2. 设计要求:1、模块化程序设计2、锯齿型书写格式3、必须上机调试通过实验报告要求:1、程序设计组成框图、流程图2、模块功能说明3、调试与
2、测试:调试方法,测试结果的分析与讨论,测试过程中遇到的主要问题及4、采取的解决措施5、源程序清单和执行结果(附盘):清单中应有足够的注释3. 设计方法图书借阅管理系统功能:设计一个图书借阅管理系统。实现下列功能: 图书信息的维护(包括录入,修改和删除); 读者信息的维护(包括录入,修改和删除); 借阅(借,还)信息的维护(包括借,还信息录 入,修改和删除); 4.总体设计1、程序设计组成框图图书读者分馆图书类别读者类型图书种类用户属于1n属于1n分类n1属于1n借阅mnmn属于1n借阅2、程序设计流程图开始用户登录图书管理借阅者管理用户管理全部图书管理借出图书管理未借图书管理借阅者信息用户信息
3、管理重试通 过3、模块功能说明1、frmStar 登录界面Option ExplicitDim Times As IntegerDim ADOLogin As New ADODB.RecordsetPrivate Sub btnCancle_Click() EndEnd SubPrivate Sub btnOK_Click() If Login(Trim(txtUser.Text), Trim(txtPwd.Text) = True Then Unload Me Else If MsgBox(输入的用户名称或者口令非法,请重新输入!, vbInformation + vbYesNo, 非法的操
4、作员口令) = vbYes Then txtUser.Text = txtPwd.Text = txtUser.SetFocus Times = Times + 1 Else End End If End IfEnd SubPrivate Sub Form_Load() ADOLogin.Open Login, ADOCon, adOpenDynamic, adLockOptimistic, -1End SubPrivate Sub Form_Unload(Cancel As Integer) ADOLogin.CloseEnd SubPrivate Sub Timer1_Timer() If
5、 Times = 3 Then EndEnd SubPrivate Sub txtUser_Change() btnOK.Enabled = TrueEnd SubPrivate Sub txtPwd_Change() btnOK.Enabled = TrueEnd SubPrivate Function Login(ByVal strUSER As String, ByVal strPWD As String) As Boolean If strUSER = Administrator Then If strPWD = Administrator Then User = Administra
6、tor UserPermission = Administrator Login = True Exit Function Else Login = False End If Else ADOLogin.MoveFirst Do Until ADOLogin.EOF If strUSER = ADOLogin.Fields(0).Value And strPWD = ADOLogin.Fields(2).Value Then User = ADOLogin.Fields(0).Value UserPermission = ADOLogin.Fields(1).Value Login = Tru
7、e Exit Function Else ADOLogin.MoveNext End If Loop Login = False End IfEnd Function2、MDIMain 主菜单页面Option ExplicitPrivate Sub MDIForm_Load() sbrMain.Panels(1).Text = 当前登陆用户: & User & & 权限: & UserPermission UserPower (UserPermission) frmReader.AddReader = FalseEnd SubPrivate Sub mnuAddBook_Click() frm
8、AddBook.ShowEnd SubPrivate Sub mnuBorrowBook_Click() frmBorrowBook.ShowEnd SubPrivate Sub mnuBorrower_Click() frmBorrower.ShowEnd SubPrivate Sub mnuBrowse_Click() frmBrowse.ShowEnd SubPrivate Sub mnuManager_Click() MsgBox HelloEnd SubPrivate Sub mnuReader_Click() frmReader.ShowEnd SubPrivate Sub mnu
9、Reload_Click() frmLogin.Show vbModal sbrMain.Panels(1).Text = 当前登陆用户: & User & & 权限: & UserPermission UserPower (UserPermission)End SubPrivate Sub mnuReturnBook_Click() frmReturnBook.ShowEnd SubPrivate Sub mnuShutdomn_Click() EndEnd SubPrivate Sub mnuUserManager_Click() frmUser.ShowEnd SubPrivate Su
10、b tbrMain_ButtonClick(ByVal ButtonIndex As Integer, ByVal ButtonKey As String) Select Case ButtonKey Case Browse Books frmBrowse.Show Case Add Books frmAddBook.Show Case Borrow Books frmBorrowBook.Show Case Return Books frmReturnBook.Show Case Reader frmReader.Show Case Borrower frmBorrower.Show Cas
11、e System User frmUser.Show Case Reload frmLogin.Show vbModal sbrMain.Panels(1).Text = 当前登陆用户: & User & & 权限: & UserPermission UserPower (UserPermission) Case ShutDown End End SelectEnd SubPrivate Sub UserPower(ByVal strUserPower As String) Select Case strUserPower Case User tbrMain.ButtonEnabled(2)
12、= False tbrMain.ButtonEnabled(6) = False tbrMain.ButtonEnabled(9) = False mnuAddBook.Enabled = False mnuUserManager.Enabled = False mnuReader.Enabled = False Case Administrator tbrMain.ButtonEnabled(2) = True tbrMain.ButtonEnabled(6) = True tbrMain.ButtonEnabled(9) = True mnuAddBook.Enabled = True m
13、nuUserManager.Enabled = True mnuReader.Enabled = True Case Else tbrMain.ButtonEnabled(2) = False tbrMain.ButtonEnabled(6) = False tbrMain.ButtonEnabled(9) = False mnuAddBook.Enabled = False mnuUserManager.Enabled = False mnuReader.Enabled = False End SelectEnd SubPrivate Sub Timer1_Timer() Dim Title
14、 As String Static L As Integer Title = 图书借阅管理系统 If L Len(Title) Then L = 0 MDIMain.Caption = Mid(Title, 1, L) L = L + 1End Sub3、frmAddBook 添加图书界面Option ExplicitPublic ADOAdd As New ADODB.RecordsetPrivate Sub btnAdd_Click()On Error GoTo LabErr txtBookID.Enabled = True txtBookName.Enabled = True txtBo
15、okAuthor.Enabled = True txtBookConcern.Enabled = True txtBookPrice.Enabled = True txtBookDate.Enabled = True txtBookClass.Enabled = True txtbookContain.Enabled = True cmbBookStatus.Enabled = True txtBookID.BackColor = vbWhite txtBookName.BackColor = vbWhite txtBookAuthor.BackColor = vbWhite txtBookC
16、oncern.BackColor = vbWhite txtBookPrice.BackColor = vbWhite txtBookDate.BackColor = vbWhite txtBookClass.BackColor = vbWhite txtbookContain.BackColor = vbWhite cmbBookStatus.BackColor = vbWhite txtBookID.Text = txtBookName.Text = txtBookAuthor.Text = txtBookConcern.Text = txtBookPrice.Text = txtBook
17、Date.Text = txtBookClass.Text = txtbookContain.Text = ADOAdd.AddNew btnSave.Enabled = True btnAdd.Enabled = False Exit SubLabErr: MsgBox 错误编号: & Err.Number & 错误描述: & Err.Description, vbCritical + vbOKOnly, 错误提示End SubPrivate Sub btnClose_Click() Unload MeEnd SubPrivate Sub btnSave_Click()On Error Go
18、To LabErrIf txtBookID.Text Then If txtBookName.Text Then If txtBookAuthor.Text Then If txtBookConcern.Text Then If txtBookPrice.Text Then If txtBookDate.Text Then If txtBookClass.Text Then If txtbookContain.Text Then If cmbBookStatus.Text Then ADOAdd.AddNew ADOAdd.Fields(0).Value = Trim(txtBookID.Te
19、xt) ADOAdd.Fields(1).Value = Trim(txtBookName.Text) ADOAdd.Fields(2).Value = Trim(txtBookAuthor.Text) ADOAdd.Fields(3).Value = Trim(txtBookConcern.Text) ADOAdd.Fields(4).Value = Trim(txtBookPrice.Text) ADOAdd.Fields(5).Value = Trim(txtBookDate.Text) ADOAdd.Fields(6).Value = Trim(txtBookClass.Text) A
20、DOAdd.Fields(7).Value = Trim(txtbookContain.Text) ADOAdd.Fields(8).Value = Trim(cmbBookStatus.Text) ADOAdd.Update Call SynData txtBookID.Text = txtBookName.Text = txtBookAuthor.Text = txtBookConcern.Text = txtBookPrice.Text = txtBookDate.Text = txtBookClass.Text = txtbookContain.Text = txtBookID.Bac
21、kColor = vbScrollBars txtBookName.BackColor = vbScrollBars txtBookAuthor.BackColor = vbScrollBars txtBookConcern.BackColor = vbScrollBars txtBookPrice.BackColor = vbScrollBars txtBookDate.BackColor = vbScrollBars txtBookClass.BackColor = vbScrollBars txtbookContain.BackColor = vbScrollBars cmbBookSt
22、atus.BackColor = vbScrollBars txtBookID.Enabled = False txtBookName.Enabled = False txtBookAuthor.Enabled = False txtBookConcern.Enabled = False txtBookPrice.Enabled = False txtBookDate.Enabled = False txtBookClass.Enabled = False txtbookContain.Enabled = False cmbBookStatus.Enabled = False btnSave.
23、Enabled = False btnAdd.Enabled = True Else MsgBox 请选择图书的当前状态为:IN, vbInformation + vbOKOnly, 信息不完整 cmbBookStatus.SetFocus End If Else MsgBox 请输入简单图书描述信息, vbInformation + vbOKOnly, 信息不完整 txtbookContain.SetFocus End If Else MsgBox 清输入图书的类别信息, vbInformation + vbOKOnly, 信息不完整 txtBookClass.SetFocus End If
24、 Else MsgBox 请按年月日格式输入图书购买的时间信息, vbInformation + vbOKOnly, 信息不完整 txtBookDate.SetFocus End If Else MsgBox 请输入图书的价格, vbInformation + vbOKOnly, 信息不完整 txtBookPrice.SetFocus End If Else MsgBox 请输入图书的出版社, vbInformation + vbOKOnly, 信息不完整 txtBookConcern.SetFocus End If Else MsgBox 请输入图书的作者名称, vbInformation
25、+ vbOKOnly, 信息不完整 txtBookAuthor.SetFocus End If Else MsgBox 请输入图书的名称, vbInformation + vbOKOnly, 信息不完整 txtBookName.SetFocus End IfElse MsgBox 请输入图书编号(唯一标识) , vbInformation + vbOKOnly, 信息不完整 txtBookID.SetFocusEnd If Exit SubLabErr: MsgBox 错误编号: & Err.Number & 错误描述: & Err.Description, vbCritical + vbOK
26、Only, 错误提示 txtBookID.Text = txtBookID.SetFocusEnd SubPrivate Sub Form_Load() Set ADOAdd = Nothing ADOAdd.Open Books, ADOCon, adOpenDynamic, adLockOptimistic, -1 Set Flex.DataSource = ADOAdd Call initial frmAddBookLoad = TrueEnd SubPrivate Sub Form_Unload(Cancel As Integer) If btnAdd.Enabled = True T
27、hen ADOAdd.Close End If frmAddBookLoad = FalseEnd SubPrivate Sub initial() Flex.ColWidth(0) = 100 Flex.ColWidth(1) = 800 Flex.ColWidth(2) = 2000 Flex.ColWidth(3) = 900 Flex.ColWidth(4) = 2000 Flex.ColWidth(5) = 800 Flex.ColWidth(6) = 900 Flex.ColWidth(7) = 1000 Flex.ColWidth(8) = 2000 Flex.ColWidth(
28、9) = 800 Flex.Col = 1 Flex.Sort = 1 cmbBookStatus.AddItem IN cmbBookStatus.AddItem OUTEnd Sub4、frmBorrower 借阅者信息界面Option ExplicitPublic ADOBbk As New ADODB.RecordsetPrivate Sub initial() Flex.ColWidth(0) = 100 Flex.ColWidth(1) = 1000 Flex.ColWidth(2) = 1000 Flex.ColWidth(3) = 1000 Flex.ColWidth(4) =
29、 2000 Flex.ColWidth(5) = 1200 Flex.ColWidth(6) = 1000 Flex.ColWidth(7) = 1500 Flex.Col = 1 Flex.Sort = 1End SubPrivate Sub btnClose_Click() Unload MeEnd SubPrivate Sub Form_Load() If frmReturnBookLoad = False And frmBorrowBookLoad = False Then Set ADOBbk = Nothing ADOBbk.Open BorrowBook, ADOCon, adO
30、penDynamic, adLockOptimistic, -1 Set Flex.DataSource = ADOBbk Else Set Flex.DataSource = ADOBbk End If Call initial frmBorrowerLoad = TrueEnd SubPrivate Sub Form_Unload(Cancel As Integer) If frmBorrowBookLoad = False And frmReturnBookLoad = False Then ADOBbk.Close End If frmBorrowerLoad = FalseEnd S
31、ub5、frmBorrowBook 查找信息管理Option ExplicitPublic AdoBow As New ADODB.RecordsetDim HaveBook As BooleanDim HaveReader As BooleanPrivate Sub btnBorrow_Click() AdoBow.MoveFirst AdoBow.Find 图书编号= & & lblBookID.Caption & , 0, adSearchBackward, adBookmarkFirst AdoBow.Fields(8).Value = OUT AdoBow.Update frmBor
32、rower.ADOBbk.AddNew frmBorrower.ADOBbk.Fields(0).Value = Trim(lblReaderID) frmBorrower.ADOBbk.Fields(1).Value = Trim(lblReaderName) frmBorrower.ADOBbk.Fields(2).Value = Trim(lblReaderPhone) frmBorrower.ADOBbk.Fields(3).Value = Trim(lblReaderAddr) frmBorrower.ADOBbk.Fields(4).Value = Trim(lblBookID)
33、frmBorrower.ADOBbk.Fields(5).Value = Date frmBorrower.ADOBbk.Fields(6).Value = Trim(lblReadernote) frmBorrower.ADOBbk.Update Set frmBorrower.ADOBbk = Nothing frmBorrower.ADOBbk.Open BorrowBook, ADOCon, adOpenDynamic, adLockOptimistic, -1 HaveBook = False HaveReader = False Call CanBorrow Call btnCle
34、ar_Click Call SynDataEnd SubPrivate Sub btnClear_Click() lblBookID.Caption = lblBookName.Caption = lblBookAuthor.Caption = lblBookConcern.Caption = lblBookPrice.Caption = lblBookDate.Caption = lblBookClass.Caption = lblBookContain.Caption = lblReaderID.Caption = lblReaderName.Caption = lblReaderPhone.Caption = lblReaderAddr.Caption = lblReadernote.Caption = End SubPrivate Sub btnClose_Click() Unload MeEnd SubPrivate Sub btnFindBook_Click() Dim BookID As StringOn Error GoTo LabErr BookID = InputBox(请输入您要查找的图书编号