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

📄 form5.frm

📁 经过几个月的设计和开发
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form5 
   Appearance      =   0  'Flat
   AutoRedraw      =   -1  'True
   BackColor       =   &H00C0FFFF&
   BorderStyle     =   0  'None
   Caption         =   "还书管理"
   ClientHeight    =   4230
   ClientLeft      =   4920
   ClientTop       =   3450
   ClientWidth     =   5760
   Icon            =   "Form5.frx":0000
   LinkTopic       =   "Form5"
   ScaleHeight     =   282
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   384
   ShowInTaskbar   =   0   'False
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   0
      Picture         =   "Form5.frx":0CCA
      ScaleHeight     =   615
      ScaleWidth      =   5775
      TabIndex        =   10
      Top             =   3720
      Width           =   5775
   End
   Begin 计算机图书管理系统2008.xp_canvas xp_canvas1 
      Height          =   2895
      Left            =   120
      TabIndex        =   0
      Top             =   720
      Width           =   5745
      _extentx        =   10134
      _extenty        =   5106
      Begin VB.Frame Frame1 
         BackColor       =   &H00C0FFFF&
         BorderStyle     =   0  'None
         Height          =   2055
         Left            =   480
         TabIndex        =   3
         Top             =   0
         Width           =   4815
         Begin VB.TextBox Text2 
            Height          =   270
            Left            =   1440
            TabIndex        =   5
            Top             =   960
            Width           =   2175
         End
         Begin VB.TextBox Text1 
            Height          =   375
            Left            =   1440
            TabIndex        =   4
            Top             =   240
            Width           =   2175
         End
         Begin VB.Label Label4 
            BackColor       =   &H00C0FFFF&
            Caption         =   "未还书总数"
            Height          =   375
            Left            =   120
            TabIndex        =   9
            Top             =   1560
            Width           =   1095
         End
         Begin VB.Label Label2 
            BackColor       =   &H00C0FFFF&
            Caption         =   "图书编号"
            Height          =   375
            Left            =   120
            TabIndex        =   8
            Top             =   1020
            Width           =   1095
         End
         Begin VB.Label Label1 
            BackColor       =   &H00C0FFFF&
            Caption         =   " 工   号"
            Height          =   375
            Left            =   120
            TabIndex        =   7
            Top             =   300
            Width           =   1095
         End
         Begin VB.Label Label3 
            BackColor       =   &H00C0FFFF&
            ForeColor       =   &H000000FF&
            Height          =   375
            Left            =   1440
            TabIndex        =   6
            Top             =   1440
            Width           =   1095
         End
      End
      Begin 计算机图书管理系统2008.xpcmdbutton Command2 
         Height          =   495
         Left            =   3240
         TabIndex        =   2
         Top             =   2160
         Width           =   1695
         _extentx        =   2990
         _extenty        =   873
         caption         =   "退  出"
         font            =   "Form5.frx":2BAA4
      End
      Begin 计算机图书管理系统2008.xpcmdbutton Command1 
         Height          =   495
         Left            =   960
         TabIndex        =   1
         Top             =   2160
         Width           =   1695
         _extentx        =   2990
         _extenty        =   873
         caption         =   "还      书"
         font            =   "Form5.frx":2BAD0
      End
   End
   Begin 计算机图书管理系统2008.xptopbuttons xptopbuttons2 
      Height          =   315
      Left            =   5040
      Top             =   240
      Width           =   315
      _extentx        =   556
      _extenty        =   556
      value           =   2
   End
   Begin 计算机图书管理系统2008.xptopbuttons xptopbuttons1 
      Height          =   315
      Left            =   5400
      Top             =   240
      Width           =   315
      _extentx        =   556
      _extenty        =   556
   End
   Begin VB.Image Image1 
      Height          =   660
      Left            =   120
      Picture         =   "Form5.frx":2BAFC
      Top             =   0
      Width           =   7515
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
Dim sql1, sql2 As String
Dim num As Integer
'检测用户名及书号正确否
sql1 = "select * from worker where [工号]=?"
sql2 = "select * from book where [图书编码]=?"
Dim param1, param2, param3 As ADODB.Parameter
Dim cmd1, cmd2, cmd3 As ADODB.Command
Set cmd1 = New ADODB.Command
Set cmd2 = New ADODB.Command
Set cmd3 = New ADODB.Command
Set param1 = New ADODB.Parameter
Set param2 = New ADODB.Parameter
Set param3 = New ADODB.Parameter

    With param1
      .Direction = adParamInput
      .Type = adBSTR
      .Size = 8
      .Value = Text1.Text
    End With
    
    cmd1.Parameters.Append param1
    cmd1.CommandText = sql1
    cmd1.CommandType = adCmdText
   Set cmd1.ActiveConnection = con
   Set rst = cmd1.Execute
   If rst.RecordCount <= 0 Then
     frmMsg.Show
     frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "没有此工号!"
     Exit Sub
   End If
   
    
    With param2
      .Direction = adParamInput
      .Type = adBSTR
      .Size = 8
      .Value = Text2.Text
    End With
    
    cmd2.Parameters.Append param2
    cmd2.CommandText = sql2
    cmd2.CommandType = adCmdText
   Set cmd2.ActiveConnection = con
   Set rst1 = cmd2.Execute
   If rst1.RecordCount <= 0 Then
      frmMsg.Show
     frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "没有此图书编号!"
      Exit Sub
   End If
  
   
    sql1 = "select * from record where [工号]=?"
     With param3
      .Direction = adParamInput
      .Type = adBSTR
      .Size = 8
      .Value = Text1.Text
    End With
    
    cmd3.Parameters.Append param1
    cmd3.CommandText = sql1
    cmd3.CommandType = adCmdText
   Set cmd3.ActiveConnection = con
   Set rst = cmd3.Execute
 
      If rst.RecordCount = 0 Then
         num = 0
         Label3.Caption = str(num)
        frmMsg.Show
     frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "您没有借阅此图书!"
         Exit Sub
       Else
         num = rst.RecordCount - 1
         
         sql1 = "select * from record where [图书编码]='" & Trim(Text2.Text) & "'" & "and [工号]='" & Trim(Text1.Text) & "'"
         Set rst1 = New ADODB.Recordset
         rst1.Open sql1, con, adOpenDynamic, adLockOptimistic
         If rst1.RecordCount <= 0 Then
           frmMsg.Show
     frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "您没有借阅此图书!"
           Exit Sub
         End If
  
          sql1 = "delete from record where [图书编码]='" & Trim(Text2.Text) & "'"
          Set rst = New ADODB.Recordset
          rst.Open sql1, con, adOpenDynamic, adLockOptimistic
         frmMsg.Show
     frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "还书成功!"
           Label3.Caption = str(num)
       End If
   
       
End Sub
    
Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim sql1, sql2 As String
sql1 = "select * from book"
sql2 = "select * from worker"
Set rst = New ADODB.Recordset
Set rst1 = New ADODB.Recordset
Call connect_db
rst.Open sql2, con, adOpenDynamic, adLockOptimistic
rst1.Open sql1, con, adOpenDynamic, adLockOptimistic
End Sub

Private Sub Image1_Click()

End Sub

Private Sub xptopbuttons1_Click()
Unload Me
End Sub

Private Sub xptopbuttons2_Click()
Me.WindowState = 1
End Sub

⌨️ 快捷键说明

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