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

📄 借书2.frm

📁 VB的图书馆管理系统.管理员的帐号和密码都是
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form07 
   Caption         =   "借书"
   ClientHeight    =   4905
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6900
   LinkTopic       =   "Form5"
   ScaleHeight     =   4905
   ScaleWidth      =   6900
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3360
      TabIndex        =   3
      Top             =   4200
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1080
      TabIndex        =   2
      Top             =   4200
      Width           =   1455
   End
   Begin VB.Frame Frame2 
      Caption         =   "用户信息"
      Height          =   1575
      Left            =   240
      TabIndex        =   1
      Top             =   2280
      Width           =   6495
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   2040
         TabIndex        =   17
         Top             =   240
         Width           =   2655
      End
      Begin VB.Label Label15 
         Height          =   375
         Left            =   2040
         TabIndex        =   19
         Top             =   720
         Width           =   2655
      End
      Begin VB.Label Label14 
         Caption         =   "姓名"
         Height          =   375
         Left            =   720
         TabIndex        =   18
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label13 
         Caption         =   "用户名"
         Height          =   375
         Left            =   720
         TabIndex        =   16
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "书籍信息"
      Height          =   2055
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6615
      Begin VB.Label Label12 
         Caption         =   "Label12"
         Height          =   375
         Left            =   4320
         TabIndex        =   15
         Top             =   1200
         Width           =   1935
      End
      Begin VB.Label Label11 
         Caption         =   "Label11"
         Height          =   375
         Left            =   4320
         TabIndex        =   14
         Top             =   720
         Width           =   1815
      End
      Begin VB.Label Label10 
         Caption         =   "Label10"
         Height          =   375
         Left            =   4320
         TabIndex        =   13
         Top             =   240
         Width           =   1815
      End
      Begin VB.Label Label9 
         Caption         =   "Label9"
         Height          =   375
         Left            =   1440
         TabIndex        =   12
         Top             =   1320
         Width           =   1575
      End
      Begin VB.Label Label8 
         Caption         =   "Label8"
         Height          =   375
         Left            =   1440
         TabIndex        =   11
         Top             =   720
         Width           =   1455
      End
      Begin VB.Label Label7 
         Caption         =   "Label7"
         Height          =   375
         Left            =   1440
         TabIndex        =   10
         Top             =   240
         Width           =   1455
      End
      Begin VB.Label Label6 
         Caption         =   "单价"
         Height          =   375
         Left            =   3240
         TabIndex        =   9
         Top             =   1200
         Width           =   735
      End
      Begin VB.Label Label5 
         Caption         =   "出版日期 "
         Height          =   375
         Left            =   3240
         TabIndex        =   8
         Top             =   720
         Width           =   735
      End
      Begin VB.Label Label4 
         Caption         =   "书名"
         Height          =   375
         Left            =   3240
         TabIndex        =   7
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "出版社"
         Height          =   375
         Left            =   600
         TabIndex        =   6
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "作者"
         Height          =   375
         Left            =   600
         TabIndex        =   5
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "图书编号"
         Height          =   375
         Left            =   600
         TabIndex        =   4
         Top             =   240
         Width           =   975
      End
   End
End
Attribute VB_Name = "Form07"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim ac As String
Dim ar As New ADODB.Recordset, ak As New ADODB.Recordset, ah As New ADODB.Recordset, aj As New ADODB.Recordset
Dim acd As New ADODB.Connection
Dim num As Integer
If Trim(Text1.Text) = "" Then
   MsgBox "请输入用户名和姓名"
   Exit Sub
   End If
acd.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\图书馆.mdb"
ac = "select*from 用户信息 where 用户名='" & Trim(Text1.Text) & "'"
ar.Open ac, acd, adOpenKeyset, adLockPessimistic
     If ar.EOF = True Then
       MsgBox "用户名不存在,请重新输入", vbOKOnly + vbExclamation
       Text1.Text = ""
       Text1.SetFocus
       Exit Sub
       Else
      num = ar.Fields(7)
     Label15.Caption = ar.Fields(4)
     End If
If num >= 3 Then
  MsgBox "该用户借书已满,不能在借书!"
  Exit Sub
  End If
  
 ac = "select *from 借书信息"
 ak.Open ac, acd, adOpenKeyset, adLockPessimistic
 ak.AddNew
 ak.Fields(1) = Label7.Caption
 ak.Fields(2) = Label10.Caption
 ak.Fields(3) = Text1.Text
 ak.Fields(4) = Label15.Caption
 ak.Fields(5) = Date
 ak.Fields(6) = Date + 14
 ak.Update
 ak.Close
 
 
 ac = "select * from 用户信息 where 用户名='" & Trim(Text1.Text) & "'"
 ah.Open ac, acd, adOpenKeyset, adLockPessimistic
 
 ah.Fields(7) = ah.Fields(7) + 1
 ah.Update
 ar.Close
 
 ac = "select * from 图书信息 where 图书编号='" & Trim(Label7.Caption) & "' "
 aj.Open ac, acd, adOpenKeyset, adLockPessimistic
 
 aj.Fields(6) = "借出"
 aj.Update
 aj.Close
 
 MsgBox "成功借阅!", vbOKOnly + vbExclamation
 Unload Me
 End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim ac As String
Dim ar1 As New ADODB.Recordset
Dim acd As New ADODB.Connection
acd.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\图书馆.mdb"
ac = "select * from 图书信息 where 图书编号='" & booknum & "'"
ar1.Open ac, acd, adOpenKeyset, adLockPessimistic
Label7.Caption = ar1.Fields(0)
Label8.Caption = ar1.Fields(2)
Label9.Caption = ar1.Fields(4)
Label10.Caption = ar1.Fields(1)
Label12.Caption = ar1.Fields(3)
Label11.Caption = ar1.Fields(5)

End Sub

⌨️ 快捷键说明

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