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

📄 form4.frm

📁 用户 是xingshidong 密码123 一个功能齐全的 能运行的VB图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form HuanShu 
   Caption         =   "还书"
   ClientHeight    =   8190
   ClientLeft      =   4200
   ClientTop       =   2880
   ClientWidth     =   10110
   LinkTopic       =   "Form4"
   ScaleHeight     =   8190
   ScaleWidth      =   10110
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   5280
      TabIndex        =   11
      Top             =   5760
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "还书"
      Height          =   495
      Left            =   2640
      TabIndex        =   10
      Top             =   5760
      Width           =   1095
   End
   Begin VB.TextBox Text5 
      Height          =   495
      Left            =   4200
      TabIndex        =   9
      Top             =   4440
      Width           =   2175
   End
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   4200
      TabIndex        =   7
      Top             =   3480
      Width           =   2175
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   4200
      TabIndex        =   5
      Top             =   2520
      Width           =   2175
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   4200
      TabIndex        =   3
      Top             =   1680
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   4200
      TabIndex        =   1
      Top             =   840
      Width           =   2175
   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          =   495
      Left            =   2640
      TabIndex        =   8
      Top             =   4560
      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          =   495
      Left            =   2640
      TabIndex        =   6
      Top             =   3600
      Width           =   1455
   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            =   2640
      TabIndex        =   4
      Top             =   2640
      Width           =   1335
   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          =   495
      Left            =   2640
      TabIndex        =   2
      Top             =   1800
      Width           =   735
   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            =   2640
      TabIndex        =   0
      Top             =   960
      Width           =   855
   End
End
Attribute VB_Name = "HuanShu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False



Private Sub Command1_Click()

    Dim up As New adodb.Recordset
    
    Dim book As New adodb.Recordset
    
    Dim back As New adodb.Recordset
    
    up.Open "select * from borrowinfo", conn, adOpenKeyset, adLockPessimistic
    
    If up.EOF = False Then
    
       Dim bid As New adodb.Recordset
    
       bid.Open "select * from borrowinfo where bookno='" & Text1.Text & "'", conn, adOpenKeyset, adLockPessimistic
       
       If bid.EOF = False Then
    
       up.Fields("bookno") = Trim(Text1)

       up.Fields("borrowno") = Trim(Text3)

       up.Fields("borrowdate") = Trim(Text5)
    
       up.Delete (adAffectCurrent)
    
       up.Update
    
       book.Open "select * from books where bookid ='" & Text1.Text & "' ", conn, adOpenKeyset, adLockPessimistic
       
       If book.EOF = False Then
    
       book.Fields(4) = Trim("未借")
    
       book.Update
    
       back.Open "select * from returninfo", conn, adOpenKeyset, adLockPessimistic
    
       back.AddNew
     
       back.Fields("bookno") = Trim(Text1)

       back.Fields("returnno") = Trim(Text3)

       back.Fields("returndate") = Trim(Date)
    
       back.Update
    
       MsgBox "还书成功"
       
       Call clear
       
       Else
       
       MsgBox "没有此书"
       
       Call clear
       
       End If
       
       Else
       
       MsgBox "非法操作,没有此书借书信息信息"
       
       Call clear
       
       End If
       
    Else
       
       Call clear
       
       MsgBox "没有借书信息"
    
    End If
       

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Text1_DblClick()

Dim id As adodb.Recordset

Dim borrow As adodb.Recordset

Dim reader As adodb.Recordset

Set id = New adodb.Recordset

Set borrow = New adodb.Recordset

Set reader = New adodb.Recordset

id.Open "select * from books where bookid='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic

If id.Fields("bookid") = "" Then

MsgBox "没有此书,请重新输入书号"

Call clear

Else
    
    borrow.Open "select * from borrowinfo where bookno='" & id.Fields("bookid") & "'", conn, adOpenStatic, adLockOptimistic

    If borrow.Fields("bookno") = "" Then
    
    MsgBox "没有此书借书信息"
    
    Call clear
    
    Else
    
       reader.Open "select * from readers where readerno='" & borrow.Fields("borrowno") & "'", conn, adOpenStatic, adLockOptimistic

       If reader.Fields("readerno") = "" Then
       
       MsgBox "没有此读者信息"
       
       Call clear
       
       Else
        
       Text2.Text = id.Fields("bookname")
 
       Text3.Text = reader.Fields("readerno")

       Text4.Text = reader.Fields("readername")
    
       Text5.Text = borrow.Fields("borrowdate")
       
       End If
       
    End If
        
End If
    
End Sub

Private Sub clear()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

Text5.Text = ""

End Sub


⌨️ 快捷键说明

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