⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 添加借书信息.frm

📁 VB图书管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         TabIndex        =   17
         Top             =   960
         Width           =   1695
      End
      Begin VB.Label Label15 
         Caption         =   "读者编号"
         Height          =   495
         Left            =   1680
         TabIndex        =   16
         Top             =   240
         Width           =   1575
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "书籍信息"
      Height          =   2175
      Left            =   360
      TabIndex        =   0
      Top             =   2400
      Width           =   7215
      Begin VB.Label Label14 
         Caption         =   "Label14"
         Height          =   375
         Left            =   4200
         TabIndex        =   14
         Top             =   1560
         Width           =   1215
      End
      Begin VB.Label Label13 
         Caption         =   "Label13"
         Height          =   375
         Left            =   1080
         TabIndex        =   13
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label Label12 
         Caption         =   "Label12"
         Height          =   375
         Left            =   3960
         TabIndex        =   12
         Top             =   840
         Width           =   1335
      End
      Begin VB.Label Label11 
         Caption         =   "Label11"
         Height          =   375
         Left            =   720
         TabIndex        =   11
         Top             =   1200
         Width           =   1215
      End
      Begin VB.Label Label10 
         Caption         =   "Label10"
         Height          =   375
         Left            =   3840
         TabIndex        =   10
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label9 
         Caption         =   "Label9"
         Height          =   375
         Left            =   720
         TabIndex        =   9
         Top             =   720
         Width           =   1575
      End
      Begin VB.Label Label8 
         Caption         =   "Label8"
         Height          =   375
         Left            =   720
         TabIndex        =   8
         Top             =   240
         Width           =   1455
      End
      Begin VB.Label Label7 
         Caption         =   "登记日期"
         Height          =   495
         Left            =   3360
         TabIndex        =   7
         Top             =   1560
         Width           =   1575
      End
      Begin VB.Label Label6 
         Caption         =   "出版日期"
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   1680
         Width           =   1695
      End
      Begin VB.Label Label5 
         Caption         =   "出版社"
         Height          =   495
         Left            =   3360
         TabIndex        =   5
         Top             =   840
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "作者"
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "类别"
         Height          =   495
         Left            =   3360
         TabIndex        =   3
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "书名"
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "编号"
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   240
         Width           =   975
      End
   End
End
Attribute VB_Name = "添加借书信息"
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
Public book_num As String


Private Sub Combo1_Change()
Combo2.ListIndex = Combo1.ListIndex
End Sub

Private Sub Combo2_Change()
Combo1.ListIndex = Combo2.ListIndex
End Sub



Private Sub Command1_Click()
Dim rs_borrowbook As New ADODB.Recordset
Dim sql As String
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset

Adodc1.RecordSource = "select * from dzxx where 读者编号='" & Combo1.Text & "'"
Adodc1.Refresh
leibie = Adodc1.Recordset.Fields(3) '得到该读者的类别
shumu = Adodc1.Recordset.Fields(8)  '得到该读者已经借的书的数目
Adodc1.RecordSource = "select * from dzlb where 种类名称='" & leibie & "'"
Adodc1.Refresh
qixian = Adodc1.Recordset.Fields(2) '得到该读者可以借书的期限
maxnum = Adodc1.Recordset.Fields(1) '得到该读者可以借书的数目
If shumu >= maxnum Then
  MsgBox "该读者借书数额已满!", vbOKOnly + vbExclamation
  Exit Sub
Else
  Set cnn = New ADODB.Connection
  cnn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;"
  '更新书籍信息表中该书籍为已经借出
  sql = "update sjxx set 是否被借出='是' where 图书编号='" & Adodc2.Recordset.Fields(0) & "'"
  cnn.Execute sql
  '更新该读者已经借书的数目
  sql = "update dzxx set 已借书数量=已借书数量+1 where 读者编号='" & Combo1.Text & "'"
  cnn.Execute sql
  '生成本次借阅信息记录
  sql = "insert into jyxx(读者编号,读者姓名,书籍编号,书籍名称,出借日期) values ('" & Combo1.Text & "','" & Combo2.Text & "','" & Label8.Caption & "','" & Label9.Caption & "','" & Date & "')"
  cnn.Execute sql
  
  MsgBox "借书成功!"
  
  
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub DataGrid1_Click()
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)
End Sub

Private Sub Form_Load()
Dim i As Integer
'Adodc2.RecordSource = "select * from  sjxx where 书籍编号='" & book_num & "'"
Adodc2.RecordSource = "select * from sjxx"
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 dzxx"
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

Public Sub BorrowOneBook()
Dim i As Integer
Adodc2.RecordSource = "select * from  sjxx 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 dzxx"
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

Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -