borrow.frm

来自「一个图书管管理软件」· FRM 代码 · 共 96 行

FRM
96
字号
VERSION 5.00
Begin VB.Form borrow 
   Caption         =   "借书"
   ClientHeight    =   1875
   ClientLeft      =   7965
   ClientTop       =   5400
   ClientWidth     =   3315
   LinkTopic       =   "Form1"
   ScaleHeight     =   1875
   ScaleWidth      =   3315
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1740
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   315
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   270
      Left            =   1740
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   795
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "借阅"
      Height          =   315
      Left            =   945
      TabIndex        =   0
      Top             =   1365
      Width           =   1065
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "读者证号"
      Height          =   180
      Left            =   420
      TabIndex        =   4
      Top             =   315
      Width           =   720
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "图书编号"
      Height          =   180
      Left            =   420
      TabIndex        =   3
      Top             =   795
      Width           =   720
   End
End
Attribute VB_Name = "borrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private strSql As String
Private rs As ADODB.Recordset
Private Sub Command1_Click()
strSql = "select * from book where bookid='" & Text2.Text & "'"
Call getRS(rs, strSql)
If rs.RecordCount = 0 Then
    MsgBox "没有该图书"
    Exit Sub
End If

strSql = "select bookstate from book where bookid='" & Text2.Text & "' and bookstate='在库'"
Call getRS(rs, strSql)
If rs.RecordCount = 1 Then
strSql = "insert into booktran(readerid,bookid,BorrowDate) values('" & Text1.Text & "','" & Text2.Text & "','" & Now & "')"
cn.Execute (strSql)

strSql = "update book set bookstate='借出' where bookid='" & Text2.Text & "'"
cn.Execute (strSql)
MsgBox "借阅成功"

Else
MsgBox "该图书已经借出"
End If
End Sub

Private Sub Command2_Click()
strSql = "select * from book where bookid='" & Text2.Text & "'"
Call getRS(rs, strSql)

End Sub

Private Sub Form_Load()
Call CnToDB
Text1.Text = ""
Text2.Text = ""
End Sub

⌨️ 快捷键说明

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