📄 frmb.frm
字号:
VERSION 5.00
Begin VB.Form FrmB
BorderStyle = 3 'Fixed Dialog
Caption = "在线借书"
ClientHeight = 2145
ClientLeft = 3405
ClientTop = 3225
ClientWidth = 3660
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2145
ScaleWidth = 3660
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdB
Cancel = -1 'True
Caption = "返回(&R)"
Height = 375
Index = 1
Left = 1920
TabIndex = 7
Top = 1560
Width = 1335
End
Begin VB.CommandButton cmdB
Caption = "确认(&O)"
Enabled = 0 'False
Height = 375
Index = 0
Left = 240
TabIndex = 6
Top = 1560
Width = 1335
End
Begin VB.TextBox Txt
ForeColor = &H00FF0000&
Height = 270
IMEMode = 3 'DISABLE
Index = 2
Left = 1200
PasswordChar = "*"
TabIndex = 5
Top = 1035
Width = 2055
End
Begin VB.TextBox Txt
ForeColor = &H00FF0000&
Height = 270
Index = 1
Left = 1200
TabIndex = 4
Top = 675
Width = 2055
End
Begin VB.TextBox Txt
ForeColor = &H000000FF&
Height = 270
Index = 0
Left = 1200
TabIndex = 1
Top = 320
Width = 2055
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "密 码"
ForeColor = &H8000000D&
Height = 180
Left = 480
TabIndex = 3
Top = 1080
Width = 450
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "学生学号"
ForeColor = &H8000000D&
Height = 180
Left = 360
TabIndex = 2
Top = 720
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "图书编号"
ForeColor = &H8000000D&
Height = 180
Left = 360
TabIndex = 0
Top = 360
Width = 720
End
End
Attribute VB_Name = "FrmB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdB_Click(Index As Integer)
On Error GoTo B_ERR
If Index = 1 Then Unload Me: Exit Sub
QueryInfo ("select * from readers where readerid='" & Txt(1) & "'")
DBRct.MoveFirst
If DBRct.Fields("pwd").Value = Txt(2) Then
Call QueryInfo("select count(*) from borrow where readerid='" & Txt(1) & "' and returndate is null")
If DBRct.Fields(0) = 5 Then MsgBox "您已经借了5本书不能再借书了!", vbInformation, "失败": Exit Sub
QueryInfo ("select * from books where bookid='" & Txt(0) & "' and bookid not in (select bookid from borrow where returndate is null)")
If MsgBox("你要借的书是:" & vbCrLf & DBRct.Fields("bookname").Value & vbCrLf & "请确认!", vbInformation + vbYesNo, "借书确认") <> 6 Then Exit Sub
DBCon.Execute ("insert into borrow (bookid,readerid) values ('" & Txt(0) & "','" & Txt(1) & "')")
MsgBox "预约借书成功!", vbInformation, "成 功"
Unload Me
Else: MsgBox "密码不正确!", vbInformation, "密码错误": Txt(2) = Empty
End If
Exit Sub
B_ERR: MsgBox "该书已经被借!" & vbCrLf & "或该ID不存在!", vbInformation, "图书不存在"
End Sub
Private Sub cmdB_KeyPress(Index As Integer, KeyAscii As Integer)
If Chr(KeyAscii) = "O" Or Chr(KeyAscii) = "o" Then cmdB_Click (0)
If Chr(KeyAscii) = "R" Or Chr(KeyAscii) = "r" Then cmdB_Click (1)
End Sub
Private Sub txt_Change(Index As Integer)
If Txt(0) = "" Or Txt(1) = "" Or Txt(2) = "" Then cmdB(0).Enabled = False Else cmdB(0).Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -