【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-VB图书管理系统源代码 - 讲义教程,希望本篇文章对您学习有所帮助。
VB图书管理系统源
代码 Private Sub Combo1_DropDown Text1.Enabled True End Sub Private Sub Combo1_LostFocus If Combo1.Text quot单个读者quot Then Text1.Enabled True Else If Combo1.Text quot全体读者quot Then Text1.Enabled False End If End If End Sub Private Sub Command1_Click Dim xh As String Dim time As Integer Dim P As Integer 此变量为标志变量判断是否找到过没有 xh TrimText1.Text If Combo1.Text quot单个读者quot Then List1.Clear P 0 Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF If Adodc1.Recordset学号 xh Then time Date - Adodc1.Recordset到期时间 P 1 If time gt 0 And Adodc1.Recordset是否挂失 quotnoquot Then List1.AddItem Adodc1.Recordset书名 End If Adodc1.Recordset.MoveNext Else Adodc1.Recordset.MoveNext End If Loop If List1.Text quot quot Then MsgBox quot没有书超期quot quot提示quot End If If P 0 Then MsgBox quot查无些人请再输入quot quot提示quot Text1.Text quotquot End If Else If Combo1.Text quot全体读者quot Then List1.Clear Text1.Text quotquot Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF time Date - Adodc1.Recordset到期时间 If time gt 0 And Adodc1.Recordset是否挂失 quotnoquot Then List1.AddItem Adodc1.Recordset学号 Space3 Adodc1.Recordset书名 End If Adodc1.Recordset.MoveNext Loop If List1.Text quot quot Then MsgBox quot无人超期quot quot提示quot End If Else MsgBox quot类型不能为空请选择quot quot提示quot Combo1.SetFocus End If End If End Sub Private Sub Command2_Click Unload Me End Sub Private Sub Form_Load Text1.Text quotquot List1.Text quotquot Adodc1.Visible False Me.Show Combo1.SetFocus cqtsct.Top Screen.Height - Me.Height / 2 cqtsct.Left Screen.Width - Me.Width / 2 End Sub Private Sub List1_Click End Sub Private Sub Text1_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End SubDim use As String pas As String Public quanxian As String Private Sub Command1_Click use TrimText1.Text pas TrimText2.Text If use ltgt quotquot Then Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF If Adodc1.Recordsetquot帐号quot use Then If Adodc1.Recordset是否禁用 quotyesquot Then MsgBox quot此用户以被禁用请启用后再进入quot quot提示quot Text1.SetFocus Exit Sub Else If Adodc1.Recordsetquot口令quot pas Then quanxian TrimAdodc1.Recordsetquot权限quot MsgBox quot
登陆成功quot quot提示quot Unload Me zjm.Show Exit Sub Else MsgBox quot密码错误请再输入quot quot提示quot Text2.SetFocus Exit Sub End If End If Else Adodc1.Recordset.MoveNext End If Loop Else MsgBox quot请输入您的用户名quot quot提示quot Text1.SetFocus End If End Sub Private Sub Command2_Click Text2.Text quotquot Text2.SetFocus End Sub Private Sub Form_Load Text1.Text quotquot Text2.Text quotquot Adodc1.Visible False Me.Show Text1.SetFocus denlu.Top Screen.Height - Me.Height / 2 denlu.Left Screen.Width - Me.Width / 2 End Sub Private Sub Text1_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End Sub Private Sub Text2_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End Sub Private Sub Command1_Click Dim xh As String xh TrimText9.Text Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF If TrimAdodc1.Recordset学号 xh Then Text1.Text Adodc1.Recordsetquot姓名quot Text2.Text Adodc1.Recordsetquot性别quot Text3.Text Adodc1.Recordsetquot年级quot Text4.Text Adodc1.Recordsetquot学号quot Text5.Text Adodc1.Recordsetquot班级quot Text6.Text Adodc1.Recordsetquot专业quot Text7.Text Adodc1.Recordsetquot系院quot Text8.Text Adodc1.Recordsetquot层次quot Exit Sub Else Adodc1.Recordset.MoveNext End If Loop If Adodc1.Recordset.EOF Then MsgBox quot查无此人请再输入quot vbExclamation vbOKOnly quot提示quot End If End Sub Private Sub Command2_Click Dim mag As String If Text1.Text quotquot Or Text2.Text quotquot Or Text3.Text quotquot Or Text4.Text quotquot Or Text5.Text quotquot Or Text6.Text quotquot Or Text7.Text quotquot Or Text8.Text quotquot Then MsgBox quot其中不能为空请输入quot quot提示quot Else msg MsgBoxquot你真的要修改吗quot vbOKCancel vbInformation quot提示quot If msg 1 Then Adodc1.Recordsetquot姓名quot Text1.Text Adodc1.Recordsetquot性别quot Text2.Text Adodc1.Recordsetquot年级quot Text3.Text Adodc1.Recordsetquot学号quot Text4.Text Adodc1.Recordsetquot班级quot Text5.Text Adodc1.Recordsetquot专业quot Text6.Text Adodc1.Recordsetquot系院quot Text7.Text Adodc1.Recordsetquot层次quot Text8.Text Adodc1.Recordset.Update End If End If End Sub Private Sub Command4_Click Unload Me End Sub Private Sub Form_Load Text1.Text quotquot Text2.Text quotquot Text3.Text quotquot Text4.Text quotquot Text5.Text quotquot Text6.Text quotquot Text7.Text quotquot Text8.Text quotquot Text9.Text quotquot Adodc1.Visible False Me.Show Text9.SetFocus dzxxct.Top Screen.Height - Me.Height / 2 dzxxct.Left Screen.Width - Me.Width / 2 End Sub Private Sub Text9_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End SubPrivate Sub Command1_Click Dim xh As String Dim sh As String xh TrimText1 sh TrimText2 Set Text1.DataSource Adodc1 Set Text2.DataSource Adodc1 If sh quotquot Or xh quotquot Then MsgBox quot学号或书号不能为空请输入quot quot提示quot If xh quotquot Then Text1.SetFocus Else Text2.SetFocus End If Exit Sub Else Do While Not Adodc1.Recordset.EOF If xh Adodc1.Recordset学号 And sh Adodc1.Recordset书号 Then If Adodc1.Recordset是否挂失 quotyesquot Then MsgBox quot此书以挂失无需再挂失quot vbOKOnly quot提示quot Exit Sub Else Set Text1.DataSource Adodc2 Set Text2.DataSource Adodc2 Adodc2.Recordset.MoveFirst Do While Not Adodc2.Recordset.EOF If Adodc2.Recordset书号 sh Then Adodc2.Recordset挂失数量 Adodc2.Recordset挂失数量 1 Adodc2.Recordset.Update Exit Do Else Adodc2.Recordset.MoveNext End If Loop Adodc1.Recordset是否挂失 quotyesquot Adodc1.Recordset.Update MsgBox quot挂失成功quot quot提示quot Text2.Text quotquot Text2.SetFocus Exit Sub End If Else Adodc1.Recordset.MoveNext End If Loop MsgBox quot你未借此书或是你输入的书号不正确quot quot提示quot Text1.SetFocus End If End Sub Private Sub Command3_Click Unload Me End Sub Private Sub Form_Load Text1.Text quotquot Text2.Text quotquot Adodc1.Visible False Adodc2.Visible False Me.Show Text1.SetFocus gsct.Top Screen.Height - Me.Height / 2 gsct.Left Screen.Width - Me.Width / 2 End Sub Private Sub Text1_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End Sub Private Sub Text2_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End SubPrivate Sub Command1_Click Dim xh As String Set Text1.DataSource Adodc1 xh TrimText1.Text Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF If TrimAdodc1.Recordset学号 xh Then Label2.Caption Adodc1.Recordsetquot姓名quot Label4.Caption Adodc1.Recordsetquot学号quot Label6.Caption Adodc1.Recordsetquot专业quot GoTo L Else Adodc1.Recordset.MoveNext End If Loop If Adodc1.Recordset.EOF Then MsgBox quot查无此人请再输入quot vbExclamation vbOKOnly quot提示quot Else L: Set Text1.DataSource Adodc2 Set conn CreateObjectquotADODB.Connectionquot Set rs CreateObjectquotADODB.recordsetquot file App.Path amp quotACCESS图书馆
管理系统.mdbquot conn.Open quotprovidermicrosoft.Jet.OLEDB.4.0Data sourcequot amp file rs.CursorLocation adUseClient rs.Open quotselect from 借书表 where 学号 like quot amp xh amp quotquot conn 1 3 Set DataGrid1.DataSource rs DataGrid1.Refresh End If End Sub Private Sub Command2_Click Dim max As Integer Set conn CreateObjectquotADODB.Connectionquot Set reco CreateObjectquotADODB.recordsetquot Set rs CreateObjectquotADODB.recordsetquot Set rs1 CreateObjectquotADODB.recordsetquot Set rs2 CreateObjectquotADODB.recordsetquot file App.Path amp quotACCESS图书馆管理
系统.mdbquot conn.Open quotprovidermicrosoft.Jet.OLEDB.4.0Data Sourcequot amp file If Text1 quotquot Or Text2 quotquot Then MsgBox quot图书编号各读者编号不能为空quot quot提示quot Else Set Text2.DataSource Adodc3 rs.Open quotselect from 读者信息表 where 学号 quot amp TrimText1 amp quotquot conn 1 1 reco.Open quotselect from 图书信息表 where 书号quot amp TrimText2 amp quot and 现在数量 gt0quot conn 1 3 If rs.EOF Or reco.EOF Then MsgBox quot图书编号或读者编号不对或者该书已被借完quot quot提示quot Else max 0 Do While Not Adodc2.Recordset.EOF If Adodc2.Recordset学号 TrimText1 Then max max 1 Adodc2.Recordset.MoveNext Else Adodc2.Recordset.MoveNext End If Loop If max gt 7 Then MsgBox quot你借的书以到8本不能再借quot quot提示quot Else If Not reco.EOF Then Adodc2.Recordset.AddNew Adodc2.Recordset学号 TrimText1 Adodc2.Recordset书号 TrimText2 Adodc2.Recordset书名 reco书名 Adodc2.Recordset版次 reco版次 Adodc2.Recordset续借次数 0 Adodc2.Recordset是否挂失 quotnoquot Adodc2.Recordset借书时间 Date Adodc2.Recordset到期时间 YearDate amp quot-quot amp StrValMonthDate 2 amp quot-quot amp DayDate Adodc2.Recordset.Update Adodc3.Recordset.MoveFirst Do While Not Adodc3.Recordset.EOF If TrimAdodc3.Recordset书号 TrimText2 Then Adodc3.Recordset现在数量 Adodc3.Recordset现在数量 - 1 Adodc3.Recordset借出数量 Adodc3.Recordset借出数量 1 Adodc3.Recordset.Update GoTo P: Else Adodc3.Recordset.MoveNext End If Loop P: MsgBox quot借阅成功quot quot提示quot Text2 quotquot Text2.SetFocus rs2.CursorLocation adUseClient rs2.Open quotselect from 借书表 where 学号 like quot amp TrimText1 amp quotquot conn 1 3 Set DataGrid1.DataSource rs2 DataGrid1.Refresh End If End If End If End If End Sub Private Sub DataGrid1_Click End Sub Private Sub Form_Load Label2.Caption quotquot Label4.Caption quotquot Label6.Caption quotquot Text1.Text quotquot Text2.Text quotquot Adodc1.Visible False Adodc2.Visible False Adodc3.Visible False Me.Show Text1.SetFocus zjm.Top Screen.Height - Me.Height / 2 zjm.Left Screen.Width - Me.Width / 2 End Sub Private Sub Text1_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1.Click End If End Sub Private Sub Text2_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command2.Click End If End SubPrivate Sub Command1_Click Dim tepy As String Dim zuozhe As String Dim name As String Dim cbs As String tepy Combo1.Text zuozhe TrimText1.Text name TrimText2.Text cbs TrimText3.Text Set conn CreateObjectquotADODB.Connectionquot Set rs CreateObjectquotADODB.recordsetquot file App.Path amp quotACCESS图书馆管理系统.mdbquot conn.Open quotprovidermicrosoft.Jet.OLEDB.4.0Data sourcequot amp file rs.CursorLocation adUseClient If tepy quotquot And zuozhe quotquot And cbs quotquot And name quotquot Then rs.Open quotselect from 图书信息表quot conn 1 1 Else rs.Open quotselect from 图书信息表 where 类型 like quot amp tepy amp quot or 主编 like quot amp zuozhe amp quot or 书名 like quot amp name amp quot or 出版社 like quot amp cbs amp quot quot conn 1 3 Set DataGrid1.DataSource rs End If Set DataGrid1.DataSource rs DataGrid1.Refresh End Sub Private Sub DataGrid1_Click End Sub Private Sub Form_Load Text1.Text quotquot Text2.Text quotquot Text3.Text quotquot Adodc1.Visible False End SubPrivate Sub Command1_Click Dim sh As String Adodc1.Recordset.MoveFirst sh TrimText12 If sh quotquot Then MsgBox quot书号不能为空quot quot提示quot Else Do While Not Adodc1.Recordset.EOF If Adodc1.Recordset书号 sh Then Text1.Text Adodc1.Recordset书名 Text2.Text Adodc1.Recordset书号 Text3.Text Adodc1.Recordset主编 Text4.Text Adodc1.Recordset类型 Text5.Text Adodc1.Recordset单价 Text6.Text Adodc1.Recordset页数 Text7.Text Adodc1.Recordset现在数量 Text8.Text Adodc1.Recordset出版时间 Text9.Text Adodc1.Recordset版次 Text10.Text Adodc1.Recordset出版社 Text11.Text Adodc1.Recordset备注 Exit Sub Else Adodc1.Recordset.MoveNext End If Loop End If End Sub Private Sub Command2_Click Dim sh As String Adodc1.Recordset.MoveFirst sh TrimText12 If sh quotquot Then MsgBox quot书号不能为空quot quot提示quot Else Do While Not Adodc1.Recordset.EOF If Adodc1.Recordset书号 sh Then Adodc1.Recordset书名 Text1.Text Adodc1.Recordset书号 Text2.Text Adodc1.Recordset主编 Text3.Text Adodc1.Recordset类型 Text4.Text Adodc1.Recordset单价 ValTrimText5.Text Adodc1.Recordset页数 ValTrimText6.Text Adodc1.Recordset现在数量 ValTrimText7.Text Adodc1.Recordset出版时间 Text8.Text Adodc1.Recordset版次 Text9.Text Adodc1.Recordset出版社 Text10.Text Adodc1.Recordset备注 Text11.Text Adodc1.Recordset.Update Exit Sub Else Adodc1.Recordset.MoveNext End If Loop End If End Sub Private Sub Command3_Click End Sub Private Sub Command4_Click Unload Me End Sub Private Sub Form_Load Text1.Text quotquot Text2.Text quotquot Text3.Text quotquot Text4.Text quotquot Text5.Text quotquot Text6.Text quotquot Text7.Text quotquot Text8.Text quotquot Text9.Text quotquot Text10.Text quotquot Text11.Text quotquot Text12.Text quotquot Me.Show Text12.SetFocus Adodc1.Visible False tsxxct.Top Screen.Height - Me.Height / 2 tsxxct.Left Screen.Width - Me.Width / 2 End Sub Private Sub List1_Click End Sub Private Sub Text12_KeyPressKeyAscii As Integer If KeyAscii 13 Then Call Command1_Click End If End SubPrivate Sub Command1_Click Dim fm As String Dim jkl As String Dim xkl As String Dim qrkl As String Dim sxkl As Integer fm TrimText1 jkl TrimText2 xkl TrimText3 qrkl TrimText4 sxkl Lensxkl If fm quotquot Or jkl quotquot Or xkl quotquot Or qrkl quotquot Then MsgBox quot户名或旧口令或新口令或确认口令不能为空请输入quot quot提示quot Text1.SetFocus Else If sxkl lt 6 Then MsgBox quot你的新密码不足6位请输入6位以上quot 64 1 quot错误quot Label5.Caption quotquot Else If xkl qrkl Then Adodc1.Recordset.MoveFirst Do While Not Adodc1.Recordset.EOF If fm Adodc1.Recordset帐号 And jkl Adodc1.Recordset口令 Then Adodc1.Recordset口令 xkl Adodc1.Recordset.Update MsgBox quot修改成功quot quot提示quot Text2.Text quotquot Text3.Text quotquot Text4.Text quotquot Text2.SetFocus Exit Sub Else Adodc1.Recordset.MoveNext End If Loop Else MsgBox quot确认口令错误请再输入quot quot提示quot Text4.Text quotquot Text4.SetFocus End If End If End If End Sub Private Sub Command2_Click Text3.Text quotquot Text2.Text quotquot .