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

📄 frmbidsearch.frm

📁 本源代码为学生图书管管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmBIDSearch 
   Caption         =   "按书号查询借书信息"
   ClientHeight    =   2505
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2505
   ScaleWidth      =   5415
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Height          =   855
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   5175
      Begin VB.TextBox txtBID 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1080
         TabIndex        =   9
         Top             =   240
         Width           =   1695
      End
      Begin VB.CommandButton cmdSearch 
         Caption         =   "查询"
         Height          =   375
         Left            =   3720
         TabIndex        =   8
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "图书编号:"
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "借书情况汇总"
      Height          =   1335
      Left            =   120
      TabIndex        =   0
      Top             =   1080
      Width           =   5175
      Begin VB.ListBox lstSID 
         Appearance      =   0  'Flat
         Height          =   570
         Left            =   120
         TabIndex        =   3
         Top             =   600
         Width           =   1335
      End
      Begin VB.ListBox lstSName 
         Appearance      =   0  'Flat
         Height          =   570
         Left            =   1440
         TabIndex        =   2
         Top             =   600
         Width           =   2175
      End
      Begin VB.ListBox lstDate 
         Appearance      =   0  'Flat
         Height          =   570
         Left            =   3600
         TabIndex        =   1
         Top             =   600
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "学   号"
         Height          =   255
         Left            =   360
         TabIndex        =   6
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "姓    名"
         Height          =   255
         Left            =   1920
         TabIndex        =   5
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "借阅日期"
         Height          =   255
         Left            =   3840
         TabIndex        =   4
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmBIDSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdSearch_Click()
    Dim strsql As String
    Dim rsinfo As New ADODB.Recordset
    Dim i As Integer
    lstSID.Clear
    lstSName.Clear
    lstDate.Clear
 
    strsql = "select * from tblbooks where bookid='" & txtBID.Text & "'"
    rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
    If rsinfo.EOF And rsinfo.BOF Then
    '查无此书
        MsgBox "所输入的图书编号不存在,请重新输入", vbOKOnly, "错误"
        rsinfo.Close
        Set rsinfo = Nothing
        txtBID.SelStart = 0
        txtBID.SelLength = Len(txtBID.Text)
        Exit Sub
    Else
        strsql = "select * from tblborrow where bid='" & txtBID.Text & "'"
        If rsinfo.State = adStateOpen Then rsinfo.Close
        rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
        If rsinfo.EOF And rsinfo.BOF Then
        '此书在库存中
            MsgBox "该书没有被借阅,仍在库存中", vbOKOnly, "提示"
        Else
        '显示借书日期
              lstSID.AddItem rsinfo!sid
              lstSID.AddItem ""
              lstDate.AddItem rsinfo!borrowdate
              lstDate.AddItem ""
        '显示图书名称
            strsql = "select * from tblstudents where sid='" & lstSID.List(0) & "'"
            If rsinfo.State = adStateOpen Then rsinfo.Close
            rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
            If Not rsinfo.EOF And Not rsinfo.BOF Then
                lstSName.AddItem rsinfo!sname
                lstSName.AddItem ""
            End If
           
        End If
    End If
        
    If rsinfo.State = adStateOpen Then rsinfo.Close
    Set rsinfo = Nothing
    
End Sub

Private Sub Form_Load()
    cmdSearch.Enabled = False
    lstSID.Clear
    lstSName.Clear
    lstDate.Clear
    
End Sub

Private Sub txtBID_Change()
 If txtBID.Text <> "" Then
    cmdSearch.Enabled = True
 End If
End Sub

⌨️ 快捷键说明

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