📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form 图书馆借书
Caption = "图书馆借书系统"
ClientHeight = 8385
ClientLeft = 165
ClientTop = 855
ClientWidth = 10740
LinkTopic = "Form2"
ScaleHeight = 8385
ScaleWidth = 10740
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 735
Left = 3840
TabIndex = 3
Top = 3120
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 735
Left = 1080
TabIndex = 2
Top = 3120
Width = 2055
End
Begin VB.TextBox Text2
Height = 735
Left = 3720
TabIndex = 1
Top = 1920
Width = 2175
End
Begin VB.TextBox Text1
Height = 735
Left = 960
TabIndex = 0
Top = 1920
Width = 2055
End
Begin VB.Label Label3
Caption = "书籍编号"
Height = 615
Left = 3720
TabIndex = 6
Top = 1320
Width = 2055
End
Begin VB.Label Label2
Caption = "图书证号"
Height = 495
Left = 960
TabIndex = 5
Top = 1320
Width = 2055
End
Begin VB.Label Label1
Caption = "图书馆借书系统"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 960
TabIndex = 4
Top = 120
Width = 4455
End
Begin VB.Menu QUERY
Caption = "图书查询"
End
Begin VB.Menu ReturnBook
Caption = "还书系统"
End
Begin VB.Menu COUNT
Caption = "统计借书情况"
End
Begin VB.Menu Modify
Caption = "修改密码"
End
Begin VB.Menu SET
Caption = "管理员设置"
End
Begin VB.Menu Exit
Caption = "退出"
End
End
Attribute VB_Name = "图书馆借书"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ADORS1 As New ADODB.Recordset
Dim ADORS2 As New ADODB.Recordset
Private Sub Command1_Click()
Dim STR1 As String '要执行的SQL语句
Dim STR2 As String
Dim str As String
STR1 = Trim(Text1.Text)
STR2 = Trim(Text2.Text)
r = 1
If Not ADORS1.BOF Then
ADORS1.MoveFirst
While Not ADORS1.EOF And r = 1
If Trim(ADORS1.Fields("door_no").Value) = Trim(Text1.Text) Then
r = 0
Else
ADORS1.MoveNext
End If
Wend
If r = 1 Then
MsgBox "无此用户"
Exit Sub
End If
Else
MsgBox "无此用户"
Exit Sub
End If
r = 1
If Not ADORS2.BOF Then
ADORS2.MoveFirst
While Not ADORS2.EOF And r = 1
If Trim(ADORS2.Fields("isbn").Value) = Trim(Text2.Text) Then
r = 0
If Trim(ADORS2.Fields("yijie")) <> "否" Then
MsgBox "该书已借"
Exit Sub
End If
Else
ADORS2.MoveNext
End If
Wend
If r = 1 Then
MsgBox "无此书"
Exit Sub
End If
Else
MsgBox "无此书"
Exit Sub
End If
str = "select * from borrower_books where door_no='" + Trim(Text1.Text) + "'"
ExecSql (str)
If adoRs.RecordCount < Maxbooks Then
i = EXECInsert2(STR1, STR2, Returnbooks)
ADORS2.Fields("yijie").Value = "是"
ADORS2.Update
MsgBox "借书成功"
Else
str = "已超过" & Maxbooks & "本,不能再借"
MsgBox str, 48
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub COUNT_Click()
统计.Show
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim str As String
Dim STR1 As String '要执行的SQL语句
Dim STR2 As String
STR1 = "select door_no from student_books "
If ADORS1.State = adStateOpen Then
ADORS1.Close
End If
ADORS1.Open STR1, Aconnection, adOpenKeyset, adLockOptimistic
If ADORS2.State = adStateOpen Then
ADORS2.Close
End If
STR2 = "select isbn,yijie from library_books "
ADORS2.Open STR2, Aconnection, adOpenKeyset, adLockOptimistic
str = "select * from LIB"
ExecSql (str)
Maxbooks = Val(adoRs.Fields("maxbooks").Value)
Returnbooks = adoRs.Fields("returnbooks").Value
Call EXECommand2
End Sub
Private Sub Modify_Click()
修改密码.Show
End Sub
Private Sub QUERY_Click()
查询.Show
End Sub
Private Sub ReturnBook_Click()
还书系统.Show
End Sub
Private Sub SET_Click()
设置.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -