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

📄 studentxxxg.frm

📁 带有SQL
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form studentxxcx 
   Caption         =   "学生信息查询"
   ClientHeight    =   8625
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   13005
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   8625
   ScaleWidth      =   13005
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   5295
      Left            =   120
      TabIndex        =   12
      Top             =   3240
      Width           =   12735
      _ExtentX        =   22463
      _ExtentY        =   9340
      _Version        =   393216
      Rows            =   25
      Cols            =   15
      FixedCols       =   2
   End
   Begin VB.Frame Frame1 
      Caption         =   "查询方式"
      Height          =   2655
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   12735
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   9240
         TabIndex        =   4
         Top             =   1080
         Width           =   2295
      End
      Begin VB.CheckBox Check4 
         Caption         =   "按寝室号查"
         Height          =   255
         Left            =   7680
         TabIndex        =   10
         Top             =   1200
         Width           =   1215
      End
      Begin VB.CheckBox Check3 
         Caption         =   "居住楼号查询"
         Height          =   255
         Left            =   1080
         TabIndex        =   9
         Top             =   1200
         Width           =   1695
      End
      Begin VB.CheckBox Check2 
         Caption         =   "按姓名查询"
         Height          =   255
         Left            =   7680
         TabIndex        =   8
         Top             =   360
         Width           =   1455
      End
      Begin VB.CheckBox Check1 
         Caption         =   "按学号查询"
         Height          =   375
         Left            =   1080
         TabIndex        =   7
         Top             =   240
         Value           =   1  'Checked
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消查找"
         Height          =   375
         Left            =   7800
         TabIndex        =   6
         Top             =   1920
         Width           =   1455
      End
      Begin VB.CommandButton Command1 
         Caption         =   "开始查找"
         Default         =   -1  'True
         Height          =   375
         Left            =   3840
         TabIndex        =   5
         Top             =   1920
         Width           =   1455
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   2880
         TabIndex        =   3
         Top             =   1080
         Width           =   2415
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   9240
         TabIndex        =   2
         Top             =   240
         Width           =   2295
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   2880
         TabIndex        =   1
         Top             =   240
         Width           =   2415
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "学生基本信息列表"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   5760
      TabIndex        =   11
      Top             =   2880
      Width           =   1920
   End
End
Attribute VB_Name = "studentxxcx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
      
       Option Explicit
       Dim mrc As ADODB.Recordset
       Dim MsgText As String
       Public txtSQL As String

Private Sub Command1_Click()
     Dim txtSQL As String
     Dim MsgText As String
     Dim mrc As ADODB.Recordset
     Dim ok(5) As Boolean
     '查找数据库中的信息
     txtSQL = "select * from student_if where "
     
     '检测复选框1是否选中,选中后学号是否已输入
     If Me.Check1.Value Then '第一种查询方式
          
         If Trim(Me.Text1.Text) = "" Then
              MsgBox "请输入学生学号!", 0, "警告"
              Me.Text1.SetFocus
              Exit Sub
         
          
         Else
            If Not IsNumeric(Me.Text1.Text) Then
            MsgBox "学号必须是数字型!", 0, "警告"
            Me.Text1.Text = ""
            Me.Text1.SetFocus
            Exit Sub
      End If
      ok(0) = True
    
          txtSQL = txtSQL & "student_ID = '" & Trim(Me.Text1.Text) & "'"
     
      End If
    End If
       
     '////////////////////////////////////
     If Me.Check2.Value Then       '第二种查询方式
        
        If Trim(Me.Text2.Text) = "" Then
           MsgBox "请输入学生姓名!", 0, "警告"
           Me.Text2.SetFocus
           Exit Sub
     
        Else
        ok(1) = True
        If ok(0) Then
            txtSQL = txtSQL & "and student_name = '" & Me.Text2.Text & "'"
         Else
            txtSQL = txtSQL & "student_name = '" & Me.Text2.Text & "'"
        End If
        End If
        End If
    '/////////////////////////////////////
     If Me.Check3.Value Then       '第三种查询方式
        
        If Trim(Me.Text3.Text) = "" Then
           MsgBox "请输入学生居住楼号", 0, "警告"
           Me.Text3.SetFocus
           Exit Sub
  
        Else
        ok(2) = True
        If ok(0) Or ok(1) Then
            txtSQL = txtSQL & "and juzhu_ID = '" & Me.Text3.Text & "'"
         Else
             txtSQL = txtSQL & "juzhu_ID = '" & Me.Text3.Text & "'"
        End If
        End If
        End If
      '/////////////////////////////////////
     If Me.Check4.Value Then       '第四种查询方式
        
        If Trim(Me.Text4.Text) = "" Then
            MsgBox "请输入学生寝室号", 0, "警告"
            Me.Text4.SetFocus
           Exit Sub
     
        Else
        ok(3) = True
        If ok(0) Or ok(1) Or ok(2) Then
            txtSQL = txtSQL & "and qs_ID = '" & Me.Text4.Text & "'"
         Else
            txtSQL = txtSQL & " qs_ID = '" & Me.Text4.Text & "'"
      End If
      End If
      End If
    If Not (ok(0) Or ok(1) Or ok(2) Or ok(3) Or ok(4)) Then
         MsgBox "您没有选择任何查询方式!", 0, "提示"
         Exit Sub
    End If
    '/////////////////////////////////////////////////////////////////
    txtSQL = txtSQL & " order by student_ID "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    '////////////////////////////////////////////////////////////////
    With MSFlexGrid1
        .Rows = 2
        .CellAlignment = 5
        .TextMatrix(0, 0) = "学    号"
        .TextMatrix(0, 1) = "姓    名"
        .TextMatrix(0, 2) = "性    别"
        .TextMatrix(0, 3) = "年    级"
        .TextMatrix(0, 4) = "系    别"
        .TextMatrix(0, 5) = "班    别"
        .TextMatrix(0, 6) = "联系电话"
        .TextMatrix(0, 7) = "政治面貌"
        .TextMatrix(0, 8) = "居住楼号"
        .TextMatrix(0, 9) = "寝 室 号"
        .TextMatrix(0, 10) = "床    位"
        .TextMatrix(0, 11) = "备    注"
     
      Do While Not mrc.EOF
          
            .Rows = .Rows + 1
            .CellAlignment = 5
            .TextMatrix(.Rows - 2, 0) = mrc.Fields(0)
            .TextMatrix(.Rows - 2, 1) = mrc.Fields(1)
            .TextMatrix(.Rows - 2, 2) = mrc.Fields(2)
            .TextMatrix(.Rows - 2, 3) = mrc.Fields(3)
            .TextMatrix(.Rows - 2, 4) = mrc.Fields(4)
            .TextMatrix(.Rows - 2, 5) = mrc.Fields(5)
            .TextMatrix(.Rows - 2, 6) = mrc.Fields(6)
            .TextMatrix(.Rows - 2, 7) = mrc.Fields(7)
            .TextMatrix(.Rows - 2, 8) = mrc.Fields(8)
            .TextMatrix(.Rows - 2, 9) = mrc.Fields(9)
            .TextMatrix(.Rows - 2, 10) = mrc.Fields(10)
            .TextMatrix(.Rows - 2, 11) = mrc.Fields(11)
            mrc.MoveNext
            
        Loop
        
    End With
    mrc.Close
    
    
    
End Sub


Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
      
       Me.Text1.Text = ""
       Me.Text2.Text = ""
       Me.Text3.Text = ""
       Me.Text4.Text = ""
       Me.MSFlexGrid1.TextMatrix(0, 0) = "学    号"
       Me.MSFlexGrid1.TextMatrix(0, 1) = "姓    名"
       Me.MSFlexGrid1.TextMatrix(0, 2) = "性    别"
       Me.MSFlexGrid1.TextMatrix(0, 3) = "年    级"
       Me.MSFlexGrid1.TextMatrix(0, 4) = "系    别"
       Me.MSFlexGrid1.TextMatrix(0, 5) = "班    别"
       Me.MSFlexGrid1.TextMatrix(0, 6) = "联系电话"
       Me.MSFlexGrid1.TextMatrix(0, 7) = "政治面貌"
       Me.MSFlexGrid1.TextMatrix(0, 8) = "居住楼号"
       Me.MSFlexGrid1.TextMatrix(0, 9) = "寝 室 号"
       Me.MSFlexGrid1.TextMatrix(0, 10) = "床    位"
       Me.MSFlexGrid1.TextMatrix(0, 11) = "备    注"
      
       Call yanse
       Call loading   '调用自定义函数
       
End Sub

Private Sub loading()
     Me.Height = 9500
     Me.Left = 10
     Me.Width = 14000
     Me.Top = 10
     Me.MSFlexGrid1.Top = 3200
     Me.MSFlexGrid1.Width = Me.Width - 650
     Me.MSFlexGrid1.Left = Me.Left + 120
     Me.MSFlexGrid1.Height = Me.Height - 4000
     Me.Frame1.Top = Me.Top + 100
     Me.Frame1.Width = Me.Width - 650
     Me.Frame1.Left = Me.Left + 120
     Me.Frame1.Height = 2655
     
End Sub
Private Sub yanse()             '定义一个让单双行显示不同的颜色
     Dim i As Integer
  With MSFlexGrid1
      .FillStyle = flexFillRepeat
      For i = 0 To .Rows - 1
     .Row = i: .Col = .FixedCols
     .ColSel = .Cols() - .FixedCols - 1
   If i Mod 2 = 0 Then
    .CellBackColor = QBColor(7)  ' 颜色值
Else
     .CellBackColor = QBColor(15) ' 颜色值
 End If
 Next i
End With

End Sub

Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
     If Button = 2 Then
       PopupMenu mainForm1.ABC
      End If
End Sub

Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
      If Button = 2 Then
        PopupMenu mainForm1.ABC
      End If
End Sub

⌨️ 快捷键说明

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