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

📄 frmreturn.frm

📁 本源代码为学生图书管管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmReturn 
   Caption         =   "还书"
   ClientHeight    =   2970
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4725
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   2970
   ScaleWidth      =   4725
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox txtTime 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFFF&
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   120
      Width           =   4215
   End
   Begin VB.CommandButton cmdReturn 
      Caption         =   "还书"
      Height          =   375
      Left            =   1320
      TabIndex        =   5
      Top             =   2520
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Height          =   1815
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   4575
      Begin VB.TextBox txtTip 
         Appearance      =   0  'Flat
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   1320
         Width           =   3975
      End
      Begin VB.TextBox txtBID 
         Appearance      =   0  'Flat
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   840
         TabIndex        =   3
         Top             =   840
         Width           =   1575
      End
      Begin VB.TextBox txtSID 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   840
         TabIndex        =   2
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label3 
         Caption         =   "书号:"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "学号:"
         Height          =   255
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   735
      End
   End
End
Attribute VB_Name = "frmReturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdReturn_Click()
    If txtSID.Text = "" Then
        MsgBox "请先输入学号", vbOKOnly, "提示"
        txtSID.SetFocus
    Else
        If txtBID.Text = "" Then
            MsgBox "输入您要还的书号", vbOKOnly, "提示"
        Else
        '查数据库中是否存在此学号所借的此书
            SearchBook
        End If
    End If
    
End Sub

Private Sub Form_Load()
    txtTime.Text = "今天是:" & Date
    
End Sub
Private Sub SearchBook()
    Dim strsql As String
    Dim rsbooks As New ADODB.Recordset
    Dim strState As String
    strState = ""
    strsql = "select * from tblborrow where sid='" & txtSID.Text & "' and bid='" & txtBID.Text & "'"
    rsbooks.Open strsql, conLIB, adOpenStatic, adLockOptimistic
    If rsbooks.EOF And rsbooks.BOF Then
        MsgBox "数据库中不存在此借阅信息,请确定学号和书号信息是否输入正确", vbOKOnly, "错误"
        rsbooks.Close
        Set rsbooks = Nothing
    Else
        '把此条记录加入到借书历史记录中,并从此库中删除此记录
        If (rsbooks!returndate < Date) Then
            strState = "1"
            MsgBox "您的书已过期,请您先去交规定的罚款!", vbOKOnly, "提示"
        Else
            strState = "0"
            
        End If
        strsql = "insert into tblreturn values('" & rsbooks!sid & "','" & rsbooks!bid & "','" & rsbooks!borrowdate & "','" & Date & "','" & strState & " ')"
        conLIB.Execute strsql
        strsql = "delete from tblborrow where sid='" & rsbooks!sid & "' and bid='" & rsbooks!bid & "'"
        conLIB.Execute strsql
        MsgBox "还书成功", vbOKOnly, "提示"
        
        rsbooks.Close
        Set rsbooks = Nothing
    End If
    
End Sub

⌨️ 快捷键说明

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