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

📄 frmborrowbook.frm

📁 中小型图书馆管理系统开发
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmBorrowBook 
   Caption         =   "借书"
   ClientHeight    =   1635
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   1635
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command2 
      Caption         =   "取消(&C)"
      Height          =   375
      Left            =   2400
      TabIndex        =   3
      Top             =   1080
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定(&S)"
      Height          =   375
      Left            =   1080
      TabIndex        =   2
      Top             =   1080
      Width           =   975
   End
   Begin VB.TextBox txtReaderID 
      Height          =   495
      Left            =   2040
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   360
      Width           =   2055
   End
   Begin VB.Label Label1 
      Caption         =   "请输入借阅者编号:"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   1695
   End
End
Attribute VB_Name = "frmBorrowBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim sql As String

Private Sub Command1_Click()
If txtReaderID.Text = "" Then
   MsgBox "请输入读者编号!!", 0 + 48, "信息提示"
   txtReaderID.SetFocus
Else
    
    '设置具体的SQL语句
    sql = "SELECT * FROM readers where id=" & txtReaderID.Text
    cmd.CommandText = sql
    
    '执行SQL语句,建立打开记录集
    rs.Open cmd, , adOpenKeyset
    
    If rs.RecordCount = 0 Then
      MsgBox "该读者不存在!!"
      txtReaderID.SetFocus
    Else
      frmBorrowBook.Visible = False
      frmBorrow.Show
    End If
    rs.Close
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
'窗体居中显示

Me.Top = (Screen.Height - Me.Height) \ 2
Me.Left = (Screen.Width - Me.Width) \ 2

txtReaderID.Text = ""

'使用Connection对象与具体的数据库文件相连接
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db\library.mdb"

'每个Command必须与一个Connection对象连接
Set cmd.ActiveConnection = conn

'设置命令的类型是使用SQL语句
cmd.CommandType = adCmdText
    

End Sub

Private Sub Form_Unload(Cancel As Integer)
conn.Close
End Sub

⌨️ 快捷键说明

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