【文章內(nèi)容簡介】
51 用戶登錄窗體 用戶登錄代碼: Const MaxLogTimes As Integer = 3 Private Sub cmdcancel_Click() If MsgBox(是否真的退出系統(tǒng)登錄? , vbYesNo, 登錄驗證 ) = vbYes Then Unload Me End If End Sub Private Sub cmdok_Click() Static intLogTimes As Integer intLogTimes = intLogTimes + 1 If intLogTimes MaxLogTimes Then MsgBox 超過登錄次數(shù)! , vbCritical, 登錄驗證 Else With .Open If .RecordCount 0 Then .MoveFirst .Find 編號 = amp。 Trim(txtLog(0)) amp。 If .EOF Then MsgBox Trim(txtLog(0)) amp。 不是系統(tǒng)用戶,請檢查輸入! , vbCritical, 登錄驗證 txtLog(0).SetFocus txtLog(0).SelStart = 0 txtLog(0).SelLength = Len(txtLog(0)) 11 ElseIf .Fields(口令 ) Trim(txtLog(1)) Then MsgBox 口令錯誤,請檢查輸入口令! , vbCritical, 登錄驗證 txtLog(1).SetFocus: txtLog(1) = Else CurrentUserNum = .Fields(編號 ) CurrentUserPassword = .Fields(口令 ) CurrentUserStatus = .Fields(權(quán)限 ) MsgBox 歡迎使用常州信息學(xué)院管理系統(tǒng)! , vbInformation, 登陸成功! Unload Me End If End If .Close End With End If End Sub Private Sub Form_Load() = RGB(192, 210, 270) End Sub ( 2)用戶管理窗體界面 圖 52 用戶管理窗體 用戶管理窗體代碼 39。保存 Private Sub cmdSave_Click() Dim objcopy As New Recordset If Trim(txtNum) = Then MsgBox 不能為空! , vbCritical, 系統(tǒng)用戶管理 = 0 = Len(txtNum) ElseIf Len(Trim(txtPwd)) 6 Then 12 MsgBox 用戶口令須為 6位字符串! , vbCritical, 系統(tǒng)用戶管理 = 0 = Len(txtPwd) ElseIf Not txtAuth Like [0,1] Then MsgBox 用戶權(quán)限必須為 0或 1, vbCritical, 系統(tǒng)用戶管理 txtAuth = Else Set objcopy = 39。對錯? With objcopy If .RecordCount 0 Then .MoveFirst .Find 編號 amp。 Trim(txtNum) amp。 If Not .EOF And .AbsolutePosition Then MsgBox 編號 : amp。 Trim(txtNum) amp。 已被使用,請選擇其他編號! , vbCritical, 系統(tǒng)用戶管理 = 0 = Len(txtNum) Exit Sub Else 39。保存記錄 MsgBox 數(shù)據(jù)保存成功! , vbInformation, 系統(tǒng)用戶管理 = True = True isAdding = False: = True End If End With End If End Sub Private Sub Form_Load() cmdMove(0).Value = True End Sub ( 3)讀者數(shù)據(jù)管理窗體界面 13 圖 53 讀者數(shù)據(jù)管理窗體 讀者數(shù)據(jù)管理窗體代碼 TRUNCATE TABLE 讀者類別 With If .State = adStateClosed Then .Open .AddNew .Fields(編號 ) = 0 .Fields(名稱 ) = 特殊 .Fields(借書量 ) = Val(txtSp(1)) .Fields(借書期 ) = Val(txtSp(2)) .Fields(有效期 ) = Val(txtSp(3)) .Update .AddNew .Fields(編號 ) = 1 .Fields(名稱 ) = 館員 .Fields(借書量 ) = Val(txtL(1)) .Fields(借書期 ) = Val(txtL(2)) .Fields(有效期 ) = Val(txtL(3)) .Update .AddNew .Update .AddNew .Fields(編號 ) = 2 .Fields(名稱 ) = 教師 .Fields(借書量 ) = Val(txtT(1)) .Fields(借書期 ) = Val(txtT(2)) .Fields(有效期 ) = Val(txtT(3)) .Update 14 .AddNew .Fields(編號 ) = 3 .Fields(名稱 ) = 學(xué)生 .Fields(借書量 ) = Val(txtS(1)) .Fields(借書期 ) = Val(txtS(2)) .Fields(有效期 ) = Val(txtS(3)) .Update End With End Sub Private Sub Form_Load() cmdMove(0).Value = True End Sub Private Sub SSTab1_DblClick() End Sub ( 4)圖書征訂管理窗體 圖 54 圖書征訂管理窗體 圖書征訂管理代碼 = Len(txtPubDate) ElseIf Trim(txtAuthor) = Then MsgBox 作者不能為空! , vbCritical, 圖書征訂管理 = 0 = Len(txtAuthor) ElseIf Val(txtNum) = Then MsgBox 正的數(shù)量無效! , vbCritical, 圖書征訂管理 15 = 0 = Len(txtNum) ElseIf Not IsDate(txtDate) = Then MsgBox 作者不能為空! , vbCritical, 圖書征訂管理 = 0 = Len(txtDate) Else 39。保存記錄 .Update MsgBox 數(shù)據(jù)保存成功! , vbInformation, 圖書征訂管理 = True: = True = True: = True isAdding = False: = True End If End Sub Dim objcopy As Recordset Private Sub cmbOut_Click() AddListOut End Sub Private Sub cmdAddAll_Click(Index As Integer) 39。選擇全部條碼 ListItem_Add lstPre(Index), LstIn(Index), Index, True End Sub Private Sub cmdAddOne_Click(Index As Integer)39。選擇當(dāng)前條碼 ListItem_Add lstPre(Index), LstIn(Index), Index, False End Sub Private Sub cmdExit_Click() If LstIn(0).ListCount 0 Then If MsgBox(你選定了部分新書準備入庫,但沒執(zhí)行保存操作 amp。 vbCr amp。 是否要執(zhí)行保存操作? , vbCritical + vbYesNo, 圖書典藏管理 ) = vbYes Then = 0 = True End If ElseIf LstIn(1).ListCount 0 Then If MsgBox(你選定了部分新書準備入庫,但沒執(zhí)行保存操作 amp。 vbCr amp。 是否要執(zhí)行保存操作? , vbCritical + vbYesNo, 圖書典藏管理 ) = vbYes Then = 1 = True End If End If Unload Me End Sub 39。刷新新書或調(diào)出庫室條碼列表 Private Sub cmdRefresh_Click(Index As Integer) 16 Select Case Index Case 0 39。刷新新書列表 With If .State = adStateClosed Then .Open .Requery End With AddListNew Case 1 39。刷新庫室條碼列表 With If .State = adStateClosed Then .Open .Requery End With AddListOut End Select End Sub Public Sub AddListNew() lstPre(0).Clear With If .State = adStateClosed Then .Open If .RecordCount 0 Then .MoveFirst While Not .EOF lstPre(0).AddItem .Fields(條碼 ) .MoveNext Wend Else lstPre(0).AddItem 當(dāng)前無待分配新書 End If End With End Sub 測試 借閱卡管理測試 進度安排測試辦理借閱證信息,檢查個人賬號、讀者可自行修改密碼。測試查詢借閱卡信息的正確性,包括輸入的讀者信息等。測試借閱卡掛失功能,包括讀者信息等 。 例如: 用戶登錄 實現(xiàn)權(quán)限登錄系統(tǒng),通過用戶名,密碼驗證登陸人身份。 添加信息 在頁面實現(xiàn)對信息的添加并能提交到數(shù)據(jù)庫。 17 修改 信息 在頁面對信息進行修改并能提交到數(shù)據(jù)庫,實現(xiàn)對數(shù)據(jù)庫信