📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form JieYue
Caption = "借书"
ClientHeight = 8445
ClientLeft = 4515
ClientTop = 2910
ClientWidth = 10440
LinkTopic = "Form1"
ScaleHeight = 8445
ScaleWidth = 10440
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 6960
TabIndex = 17
Top = 7680
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "借阅"
Height = 375
Left = 1920
TabIndex = 16
Top = 7680
Width = 1335
End
Begin VB.Frame Frame2
Caption = "读者信息"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 6615
Left = 5400
TabIndex = 1
Top = 600
Width = 4815
Begin VB.TextBox Text7
Height = 375
Left = 2160
TabIndex = 15
Top = 840
Width = 2055
End
Begin VB.TextBox Text6
Height = 375
Left = 2160
TabIndex = 13
Top = 1800
Width = 2055
End
Begin VB.Label Label7
Caption = "借书证号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 14
Top = 960
Width = 1455
End
Begin VB.Label Label6
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 12
Top = 1920
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "图书信息"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 6615
Left = 240
TabIndex = 0
Top = 600
Width = 4815
Begin VB.TextBox Text8
Height = 375
Left = 2040
TabIndex = 19
Top = 3600
Width = 2055
End
Begin VB.TextBox Text5
Height = 375
Left = 2040
TabIndex = 11
Top = 5640
Width = 2055
End
Begin VB.TextBox Text4
Height = 375
Left = 2040
TabIndex = 9
Top = 4680
Width = 2055
End
Begin VB.TextBox Text3
Height = 375
Left = 2040
TabIndex = 7
Top = 2760
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 2040
TabIndex = 5
Top = 1800
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 2040
TabIndex = 3
Top = 840
Width = 2055
End
Begin VB.Label Label8
Caption = "作者"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 18
Top = 3720
Width = 615
End
Begin VB.Label Label5
Caption = "借阅状态"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 10
Top = 5760
Width = 1335
End
Begin VB.Label Label4
Caption = "出版商"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 8
Top = 4800
Width = 975
End
Begin VB.Label Label3
Caption = "类型"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 6
Top = 2880
Width = 615
End
Begin VB.Label Label2
Caption = "书名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 4
Top = 1920
Width = 615
End
Begin VB.Label Label1
Caption = "书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 2
Top = 960
Width = 1095
End
End
End
Attribute VB_Name = "JieYue"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text5.Text = "已借出" Then
MsgBox "此书已被借出"
Call clear
Else
Dim bid As New adodb.Recordset
bid.Open "select * from borrowinfo where bookno='" & Text1.Text & "'", conn, adOpenKeyset, adLockPessimistic
If bid.EOF = True Then
If Text1.Text <> "" And Text7.Text <> "" Then
Dim borrow As New adodb.Recordset
Dim book As New adodb.Recordset
Dim name As New adodb.Recordset
book.Open "select * from books where bookid ='" & Text1.Text & "' ", conn, adOpenKeyset, adLockPessimistic
name.Open "select * from readers where readerno ='" & Text7.Text & "' ", conn, adOpenKeyset, adLockPessimistic
If book.EOF = False And name.EOF = False Then
borrow.Open "select * from borrowinfo", conn, adOpenKeyset, adLockPessimistic
borrow.AddNew
borrow.Fields(0) = Trim(Text1)
borrow.Fields(1) = Trim(Text7)
borrow.Fields(2) = Trim(Date)
borrow.Update
book.Fields(4) = Trim("已借出")
book.Update
MsgBox "借阅成功"
Call clear
Text6.Text = ""
Text7.Text = ""
Else
MsgBox "书号或借书证号有误,请重新输入"
Call clear
Text6.Text = ""
Text7.Text = ""
End If
Else
MsgBox "请输入书号和借书证号"
Call clear
Text6.Text = ""
Text7.Text = ""
End If
Else
MsgBox "非法操作,已存在此书借书信息"
Call clear
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_DblClick()
Dim id As adodb.Recordset
Set id = New adodb.Recordset
With id
id.Open "select * from books where bookid='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic
If id.Fields("bookid") = "" Then
MsgBox "没有此书,请重新输入书号"
Call clear
Else
Text2.Text = id.Fields("bookname")
Text3.Text = id.Fields("booktype")
Text4.Text = id.Fields("bookpub")
Text5.Text = id.Fields("putup")
Text8.Text = id.Fields("writer")
End If
End With
End Sub
Private Sub Text7_DblClick()
Dim id As adodb.Recordset
Set id = New adodb.Recordset
With id
id.Open "select * from readers where readerno='" & Text7.Text & "'", conn, adOpenStatic, adLockOptimistic
If id.Fields("readerno") = "" Then
MsgBox "没有此读者,请重新输入借书证号"
Text6.Text = ""
Text7.Text = ""
Else
Text6.Text = id.Fields("readername")
End If
End With
End Sub
Private Sub clear()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text8.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -