📄 frmborrowbook.frm
字号:
Caption = "Label14"
DataSource = "Adodc2"
Height = 255
Left = 4320
TabIndex = 17
Top = 1440
Width = 1935
End
Begin VB.Label Label13
BackColor = &H00FFFF80&
Caption = "Label13"
DataSource = "Adodc2"
Height = 255
Left = 960
TabIndex = 16
Top = 1560
Width = 2055
End
Begin VB.Label Label12
BackColor = &H00FFFF80&
Caption = "Label12"
DataSource = "Adodc2"
Height = 255
Left = 4320
TabIndex = 15
Top = 1080
Width = 2415
End
Begin VB.Label Label11
BackColor = &H00FFFF80&
Caption = "Label11"
DataSource = "Adodc2"
Height = 375
Left = 960
TabIndex = 14
Top = 1080
Width = 2175
End
Begin VB.Label Label10
BackColor = &H00FFFF80&
Caption = "Label10"
DataSource = "Adodc2"
Height = 255
Left = 4320
TabIndex = 13
Top = 600
Width = 2175
End
Begin VB.Label Label9
BackColor = &H00FFFF80&
Caption = "Label9"
DataSource = "Adodc2"
Height = 375
Left = 960
TabIndex = 12
Top = 600
Width = 2175
End
Begin VB.Label Label8
BackColor = &H00FFFF80&
Caption = "Label8"
DataSource = "Adodc2"
Height = 255
Left = 960
TabIndex = 11
Top = 240
Width = 1815
End
Begin VB.Label Label7
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "登记日期"
Height = 420
Left = 3360
TabIndex = 10
Top = 1440
Width = 1080
End
Begin VB.Label Label6
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "出版日期"
Height = 180
Left = 120
TabIndex = 9
Top = 1560
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "出版社"
Height = 180
Left = 3600
TabIndex = 8
Top = 1080
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "作者"
Height = 180
Left = 480
TabIndex = 7
Top = 1080
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "类别"
Height = 180
Left = 3720
TabIndex = 6
Top = 600
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "书名"
Height = 180
Left = 480
TabIndex = 5
Top = 600
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "编号"
Height = 180
Left = 480
TabIndex = 4
Top = 240
Width = 360
End
End
End
Attribute VB_Name = "frmborrowbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim leibie As String '该读者的类别
Dim qixian As Integer '该读者可以借书的期限
Dim shumu As Integer '该读者已借书数量
Dim maxnum As Integer '该读者借书数量的限制
Private Sub Combo1_Click()
Combo2.ListIndex = Combo1.ListIndex
End Sub
Private Sub Combo2_Click()
Combo1.ListIndex = Combo2.ListIndex
End Sub
Private Sub Command1_Click()
Dim rs_borrowbook As New ADODB.Recordset
Dim sql As String
Adodc1.RecordSource = "select * from 读者信息 where 读者编号='" & Combo1.Text & "'"
Adodc1.Refresh
leibie = Adodc1.Recordset.Fields(3)
shumu = Adodc1.Recordset.Fields(8)
Adodc1.RecordSource = "select * from 读者类别 where 种类名称='" & leibie & "'"
Adodc1.Refresh
qixian = Adodc1.Recordset.Fields(2)
maxnum = Adodc1.Recordset.Fields(1)
If shumu >= maxnum Then
MsgBox "该读者借书数额已满!", vbOKOnly + vbExclamation
Exit Sub
End If
Adodc3.RecordSource = "select * from 借阅信息"
Adodc3.Refresh
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields(1) = Combo1.Text
Adodc3.Recordset.Fields(2) = Combo2.Text
Adodc3.Recordset.Fields(3) = Label8.Caption
Adodc3.Recordset.Fields(4) = Label9.Caption
Adodc3.Recordset.Fields(5) = Date
Adodc3.Recordset.Fields(6) = DateAdd("Ww", qixian, Date)
Adodc3.Recordset.Update
Adodc2.RecordSource = "select * from 书籍信息 where 书籍编号='" & book_num & "'"
Adodc2.Refresh
Adodc2.Recordset.Fields(7) = "是"
Adodc2.Recordset.Update
Adodc1.RecordSource = "select * from 读者信息 where 读者编号='" & Combo1.Text & "'"
Adodc1.Refresh
Adodc1.Recordset.Fields(8) = Adodc1.Recordset.Fields(8) + 1
Adodc1.Recordset.Update
MsgBox "本书借阅成功!", vbOKOnly + vbExclamation
frmfindbook.Adodc1.Refresh
frmfindbook.DataGrid1.Refresh
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
Adodc2.RecordSource = "select * from 书籍信息 where 书籍编号='" & book_num & "'"
Adodc2.Refresh
Label8.Caption = Adodc2.Recordset.Fields(0)
Label9.Caption = Adodc2.Recordset.Fields(1)
Label10.Caption = Adodc2.Recordset.Fields(2)
Label11.Caption = Adodc2.Recordset.Fields(3)
Label12.Caption = Adodc2.Recordset.Fields(4)
Label13.Caption = Adodc2.Recordset.Fields(5)
Label14.Caption = Adodc2.Recordset.Fields(6)
Combo1.Clear
Combo2.Clear
Adodc1.RecordSource = "select * from 读者信息"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
For i = 0 To Adodc1.Recordset.RecordCount - 1
Combo1.AddItem Adodc1.Recordset.Fields(1).Value
Combo2.AddItem Adodc1.Recordset.Fields(0).Value
Adodc1.Recordset.MoveNext
Next
Combo1.ListIndex = 0
Combo2.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -