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

📄 frmsidsearch.frm

📁 本源代码为学生图书管管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSIDSearch 
   Caption         =   "按学号查询图书借阅情况"
   ClientHeight    =   4875
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5985
   LinkTopic       =   "Form1"
   ScaleHeight     =   4875
   ScaleWidth      =   5985
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "借书情况汇总"
      Height          =   3735
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   5775
      Begin VB.TextBox txtTip 
         Appearance      =   0  'Flat
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   120
         TabIndex        =   11
         Top             =   3000
         Width           =   4935
      End
      Begin VB.ListBox lstDate 
         Appearance      =   0  'Flat
         Height          =   2370
         Left            =   3600
         TabIndex        =   10
         Top             =   600
         Width           =   1455
      End
      Begin VB.ListBox lstBName 
         Appearance      =   0  'Flat
         Height          =   2370
         Left            =   1440
         TabIndex        =   9
         Top             =   600
         Width           =   2175
      End
      Begin VB.ListBox lstBID 
         Appearance      =   0  'Flat
         Height          =   2370
         Left            =   120
         TabIndex        =   8
         Top             =   600
         Width           =   1335
      End
      Begin VB.Label Label4 
         Caption         =   "借阅日期"
         Height          =   255
         Left            =   3840
         TabIndex        =   7
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "图 书 名 称"
         Height          =   255
         Left            =   1920
         TabIndex        =   6
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "图 书 编 号"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Height          =   855
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5775
      Begin VB.CommandButton cmdSearch 
         Caption         =   "查询"
         Height          =   375
         Left            =   4200
         TabIndex        =   3
         Top             =   240
         Width           =   975
      End
      Begin VB.TextBox txtSID 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   720
         TabIndex        =   2
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label1 
         Caption         =   "学号:"
         Height          =   375
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmSIDSearch"
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
    lstBID.Clear
    lstBName.Clear
    lstDate.Clear
    txtTip.Text = ""
    strsql = "select * from tblstudents where sid='" & txtSID.Text & "'"
    rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
    If rsinfo.EOF And rsinfo.BOF Then
    '查无此人
        MsgBox "学号输入错误,请重输入", vbOKOnly, "错误"
        rsinfo.Close
        Set rsinfo = Nothing
        txtSID.SelStart = 0
        txtSID.SelLength = Len(txtSID.Text)
        Exit Sub
    Else
        strsql = "select * from tblborrow where sid='" & txtSID.Text & "'"
        If rsinfo.State = adStateOpen Then rsinfo.Close
        rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
        If rsinfo.EOF And rsinfo.BOF Then
        '此人没有借书
            MsgBox "该学生没有借书记录", vbOKOnly, "提示"
        Else
        '显示借书信息
            While Not rsinfo.EOF
               lstBID.AddItem rsinfo!bid
               lstBID.AddItem ""
               lstDate.AddItem rsinfo!borrowdate
               lstDate.AddItem ""
               rsinfo.MoveNext
            Wend
            '显示图书名称
            For i = 0 To lstBID.ListCount - 1
              strsql = "select * from tblbooks where bookid='" & lstBID.List(i) & "'"
              If rsinfo.State = adStateOpen Then rsinfo.Close
              rsinfo.Open strsql, conLIB, adOpenDynamic, adLockOptimistic
              If Not rsinfo.EOF And Not rsinfo.BOF Then
                lstBName.AddItem rsinfo!bookname
                lstBName.AddItem ""
              End If
            Next i
        End If
    End If
    txtTip.Text = "共有 " & lstBID.ListCount / 2 & "本书未还!"
    
    If rsinfo.State = adStateOpen Then rsinfo.Close
    Set rsinfo = Nothing
    
End Sub

Private Sub Form_Load()
    cmdSearch.Enabled = False
    lstBID.Clear
    lstBName.Clear
    lstDate.Clear
    
End Sub

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

⌨️ 快捷键说明

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