📄 stuinfoclassfy.vb
字号:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class Form24
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form24))
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Button2 = New System.Windows.Forms.Button
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.RadioButton4 = New System.Windows.Forms.RadioButton
Me.RadioButton3 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.GroupBox1.SuspendLayout()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Button2)
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.RadioButton4)
Me.GroupBox1.Controls.Add(Me.RadioButton3)
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton1)
Me.GroupBox1.Location = New System.Drawing.Point(8, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(464, 104)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "查询条件"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(280, 64)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(72, 24)
Me.Button2.TabIndex = 6
Me.Button2.Text = "关闭"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(192, 64)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 5
Me.Button1.Text = "分类管理"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(24, 64)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(128, 21)
Me.TextBox1.TabIndex = 4
Me.TextBox1.Text = ""
'
'RadioButton4
'
Me.RadioButton4.Location = New System.Drawing.Point(336, 24)
Me.RadioButton4.Name = "RadioButton4"
Me.RadioButton4.Size = New System.Drawing.Size(64, 24)
Me.RadioButton4.TabIndex = 3
Me.RadioButton4.Text = "系部"
'
'RadioButton3
'
Me.RadioButton3.Location = New System.Drawing.Point(232, 24)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(56, 24)
Me.RadioButton3.TabIndex = 2
Me.RadioButton3.Text = "专业"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(128, 24)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(56, 24)
Me.RadioButton2.TabIndex = 1
Me.RadioButton2.Text = "年级"
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(24, 24)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(72, 24)
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.Text = "班级号"
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(0, 112)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(472, 248)
Me.DataGrid1.TabIndex = 1
'
'Form24
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.Color.Teal
Me.ClientSize = New System.Drawing.Size(472, 365)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.GroupBox1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "Form24"
Me.Text = "学生信息分类"
Me.GroupBox1.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
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 RadioButton1.Checked Then
classquery()
ElseIf RadioButton2.Checked Then
gradequery()
ElseIf RadioButton3.Checked Then
professinalquery()
ElseIf RadioButton4.Checked Then
departquery()
End If
End Sub
Sub classquery()
Dim str As String
Dim ds As New DataSet
Dim da As SqlDataAdapter
'Dim frmName As String = "欢迎您"
str = "Data Source=localhost;Initial Catalog = Student;integrated Security=true"
Dim con As New SqlConnection(str)
con.Open()
Dim sql As String = "select * from student_Info where class_No = '" & TextBox1.Text.ToString().Trim() & "' "
da = New SqlDataAdapter(sql, con)
da.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Sub gradequery()
Dim str As String
Dim ds As New DataSet
Dim da As SqlDataAdapter
'Dim frmName As String = "欢迎您"
str = "Data Source=localhost;Initial Catalog = Student;integrated Security=true"
Dim con As New SqlConnection(str)
con.Open()
Dim sql As String = "select * from student_Info s,class_Info c where s.class_No=c.class_No and grade = '" & TextBox1.Text.ToString().Trim() & "' "
da = New SqlDataAdapter(sql, con)
da.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Sub professinalquery()
Dim str As String
Dim ds As New DataSet
Dim da As SqlDataAdapter
'Dim frmName As String = "欢迎您"
str = "Data Source=localhost;Initial Catalog = Student;integrated Security=true"
Dim con As New SqlConnection(str)
con.Open()
Dim sql As String = "select * from student_Info s,class_Info c where s.class_No=c.class_No and director like '" & TextBox1.Text.ToString().Trim() & "' "
da = New SqlDataAdapter(sql, con)
da.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Sub departquery()
Dim str As String
Dim ds As New DataSet
Dim da As SqlDataAdapter
'Dim frmName As String = "欢迎您"
str = "Data Source=localhost;Initial Catalog = Student;integrated Security=true"
Dim con As New SqlConnection(str)
con.Open()
Dim sql As String = "select * from student_Info s,depart_Info d where s.depart_ID=d.depart_ID and d.depart_Name like '" & TextBox1.Text.ToString().Trim() & "' "
da = New SqlDataAdapter(sql, con)
da.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -