📄 qsqkcx.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class qsqkcx
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 groupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents dataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents groupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents dataGrid2 As System.Windows.Forms.DataGrid
Friend WithEvents groupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents textBox1 As System.Windows.Forms.TextBox
Friend WithEvents button1 As System.Windows.Forms.Button
Friend WithEvents label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.groupBox2 = New System.Windows.Forms.GroupBox
Me.dataGrid1 = New System.Windows.Forms.DataGrid
Me.groupBox3 = New System.Windows.Forms.GroupBox
Me.dataGrid2 = New System.Windows.Forms.DataGrid
Me.groupBox1 = New System.Windows.Forms.GroupBox
Me.textBox1 = New System.Windows.Forms.TextBox
Me.button1 = New System.Windows.Forms.Button
Me.label1 = New System.Windows.Forms.Label
Me.groupBox2.SuspendLayout()
CType(Me.dataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.groupBox3.SuspendLayout()
CType(Me.dataGrid2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.groupBox1.SuspendLayout()
Me.SuspendLayout()
'
'groupBox2
'
Me.groupBox2.Controls.Add(Me.dataGrid1)
Me.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill
Me.groupBox2.Location = New System.Drawing.Point(0, 72)
Me.groupBox2.Name = "groupBox2"
Me.groupBox2.Size = New System.Drawing.Size(544, 174)
Me.groupBox2.TabIndex = 7
Me.groupBox2.TabStop = False
Me.groupBox2.Text = "寝室信息"
'
'dataGrid1
'
Me.dataGrid1.CaptionVisible = False
Me.dataGrid1.DataMember = ""
Me.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dataGrid1.Location = New System.Drawing.Point(8, 16)
Me.dataGrid1.Name = "dataGrid1"
Me.dataGrid1.ReadOnly = True
Me.dataGrid1.Size = New System.Drawing.Size(528, 152)
Me.dataGrid1.TabIndex = 0
'
'groupBox3
'
Me.groupBox3.Controls.Add(Me.dataGrid2)
Me.groupBox3.Dock = System.Windows.Forms.DockStyle.Bottom
Me.groupBox3.Location = New System.Drawing.Point(0, 246)
Me.groupBox3.Name = "groupBox3"
Me.groupBox3.Size = New System.Drawing.Size(544, 152)
Me.groupBox3.TabIndex = 8
Me.groupBox3.TabStop = False
Me.groupBox3.Text = "各寝室详细信息"
'
'dataGrid2
'
Me.dataGrid2.CaptionVisible = False
Me.dataGrid2.DataMember = ""
Me.dataGrid2.Dock = System.Windows.Forms.DockStyle.Fill
Me.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dataGrid2.Location = New System.Drawing.Point(3, 17)
Me.dataGrid2.Name = "dataGrid2"
Me.dataGrid2.ReadOnly = True
Me.dataGrid2.Size = New System.Drawing.Size(538, 132)
Me.dataGrid2.TabIndex = 0
'
'groupBox1
'
Me.groupBox1.Controls.Add(Me.textBox1)
Me.groupBox1.Controls.Add(Me.button1)
Me.groupBox1.Controls.Add(Me.label1)
Me.groupBox1.Dock = System.Windows.Forms.DockStyle.Top
Me.groupBox1.Location = New System.Drawing.Point(0, 0)
Me.groupBox1.Name = "groupBox1"
Me.groupBox1.Size = New System.Drawing.Size(544, 72)
Me.groupBox1.TabIndex = 6
Me.groupBox1.TabStop = False
Me.groupBox1.Text = "查询条件"
'
'textBox1
'
Me.textBox1.Location = New System.Drawing.Point(176, 32)
Me.textBox1.Name = "textBox1"
Me.textBox1.TabIndex = 2
Me.textBox1.Text = ""
'
'button1
'
Me.button1.Location = New System.Drawing.Point(312, 32)
Me.button1.Name = "button1"
Me.button1.TabIndex = 1
Me.button1.Text = "查 询"
'
'label1
'
Me.label1.Location = New System.Drawing.Point(56, 32)
Me.label1.Name = "label1"
Me.label1.TabIndex = 0
Me.label1.Text = "寝室号:"
Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'qsqkcx
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(544, 398)
Me.Controls.Add(Me.groupBox2)
Me.Controls.Add(Me.groupBox3)
Me.Controls.Add(Me.groupBox1)
Me.Name = "qsqkcx"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "寝室信息查询"
Me.groupBox2.ResumeLayout(False)
CType(Me.dataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.groupBox3.ResumeLayout(False)
CType(Me.dataGrid2, System.ComponentModel.ISupportInitialize).EndInit()
Me.groupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Shared m_Form As New qsqkcx
Public Shared ReadOnly Property NewForm() As qsqkcx
Get
If m_Form Is Nothing OrElse m_Form.IsDisposed Then
m_Form = New qsqkcx
End If
Return m_Form
End Get
End Property
Private Sub qsqkcx_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As SqlConnection = New SqlConnection(Me.Tag)
Dim meadpter As SqlDataAdapter = New SqlDataAdapter("SELECT * from 学生寝室表", conn)
Dim mebuiler As SqlCommandBuilder = New SqlCommandBuilder(meadpter)
Dim mydate As DataSet = New DataSet
meadpter.Fill(mydate, "学生寝室表")
Dim conn1 As SqlConnection = New SqlConnection(Me.Tag)
Dim meadpter1 As SqlDataAdapter = New SqlDataAdapter("SELECT * from 寝室表", conn)
Dim mebuiler1 As SqlCommandBuilder = New SqlCommandBuilder(meadpter)
Dim mydate1 As DataSet = New DataSet
meadpter1.Fill(mydate1, "寝室表")
dataGrid2.SetDataBinding(mydate, "学生寝室表")
dataGrid1.SetDataBinding(mydate1, "寝室表")
End Sub
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Dim conn As SqlConnection = New SqlConnection(Me.Tag)
Dim meadpter As SqlDataAdapter = New SqlDataAdapter("SELECT * from 学生寝室表 where 寝室号='" + Me.textBox1.Text + "'", conn)
Dim mebuiler As SqlCommandBuilder = New SqlCommandBuilder(meadpter)
Dim mydate As DataSet = New DataSet
meadpter.Fill(mydate, "学生寝室表")
Dim conn1 As SqlConnection = New SqlConnection(Me.Tag)
Dim meadpter1 As SqlDataAdapter = New SqlDataAdapter("SELECT * from 寝室表 where 寝室号='" + Me.textBox1.Text + "'", conn)
Dim mebuiler1 As SqlCommandBuilder = New SqlCommandBuilder(meadpter)
Dim mydate1 As DataSet = New DataSet
meadpter1.Fill(mydate1, "寝室表")
dataGrid2.SetDataBinding(mydate, "学生寝室表")
dataGrid1.SetDataBinding(mydate1, "寝室表")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -