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

📄 宿舍纪律分统计.vb

📁 一个功能强大的学生公寓管理系统 界面非常友好 十分强大
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(496, 48)
        Me.Panel1.TabIndex = 1
        '
        'Button3
        '
        Me.Button3.BackColor = System.Drawing.SystemColors.Control
        Me.Button3.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button3.Location = New System.Drawing.Point(368, 8)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(64, 32)
        Me.Button3.TabIndex = 3
        Me.Button3.Text = "返回"
        '
        'Button2
        '
        Me.Button2.BackColor = System.Drawing.SystemColors.Control
        Me.Button2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button2.Location = New System.Drawing.Point(432, 8)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(56, 32)
        Me.Button2.TabIndex = 4
        Me.Button2.Text = "退出"
        '
        'Button1
        '
        Me.Button1.BackColor = System.Drawing.SystemColors.Control
        Me.Button1.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Button1.Location = New System.Drawing.Point(304, 8)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(64, 32)
        Me.Button1.TabIndex = 2
        Me.Button1.Text = "查询"
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(72, 16)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.Size = New System.Drawing.Size(80, 21)
        Me.TextBox3.TabIndex = 0
        Me.TextBox3.Text = ""
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label2.Location = New System.Drawing.Point(160, 16)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(39, 22)
        Me.Label2.TabIndex = 16
        Me.Label2.Text = "房号"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.Location = New System.Drawing.Point(16, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(39, 22)
        Me.Label1.TabIndex = 15
        Me.Label1.Text = "栋号"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(208, 16)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(80, 21)
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = ""
        '
        '宿舍纪律分统计
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(528, 437)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.DataGrid1)
        Me.Name = "宿舍纪律分统计"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "宿舍纪律分统计"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.Yx1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.Panel1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub 宿舍纪律分统计_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            OleDbDataAdapter1.SelectCommand.CommandText = "select 栋号,房号,sum(扣分) As 累积扣分 from 宿舍纪律 group by 栋号,房号"
            Yx1.Clear()
            OleDbDataAdapter1.Fill(Yx1)
            Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Try
            OleDbDataAdapter1.SelectCommand.CommandText = "select 栋号,房号,sum(扣分) As 累积扣分 from 宿舍纪律 group by 栋号,房号"
            Yx1.Clear()
            OleDbDataAdapter1.Fill(Yx1)
            Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" And TextBox3.Text = "" Then
            MsgBox("查询条件不能全为空!")
        End If
        Try
            Dim ComStr As String
            ComStr = "select 栋号,房号,sum(扣分) As 累积扣分 from 宿舍纪律 where 栋号 like'"

            ComStr &= Trim(TextBox3.Text) & "%'"


            If TextBox1.Text <> "" Then
                ComStr &= "and 房号 like'" & Trim(TextBox1.Text) & "%'"

            End If

            ComStr &= "group by 栋号,房号"

            OleDbDataAdapter1.SelectCommand.CommandText = ComStr
            Yx1.Clear()
            OleDbDataAdapter1.Fill(Yx1)
            Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
        Catch ex As Exception
            MsgBox("没有您要查询的数据!")
        End Try

        TextBox1.Text = ""
        TextBox3.Text = ""
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class

⌨️ 快捷键说明

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