📄 form4.vb
字号:
Public Class Form4
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 Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Friend WithEvents DataSet71 As 人事管理.DataSet7
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form4))
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.DataSet71 = New 人事管理.DataSet7
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataSet71, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Black
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.Label1.Location = New System.Drawing.Point(88, 104)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(96, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "职工编号:"
'
'TextBox1
'
Me.TextBox1.AutoSize = False
Me.TextBox1.BackColor = System.Drawing.Color.Black
Me.TextBox1.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.TextBox1.Location = New System.Drawing.Point(192, 96)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox1.Size = New System.Drawing.Size(200, 40)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Black
Me.Button1.Cursor = System.Windows.Forms.Cursors.Hand
Me.Button1.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.Button1.Location = New System.Drawing.Point(88, 240)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 32)
Me.Button1.TabIndex = 2
Me.Button1.Text = "查 看"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.Color.Black
Me.Button2.Cursor = System.Windows.Forms.Cursors.Hand
Me.Button2.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.Button2.Location = New System.Drawing.Point(280, 240)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(104, 32)
Me.Button2.TabIndex = 3
Me.Button2.Text = "重 置"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Black
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlLightLight
Me.Label2.Location = New System.Drawing.Point(96, 24)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(272, 24)
Me.Label2.TabIndex = 4
Me.Label2.Text = "欢迎您进入奖惩登录页面"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'DataGrid1
'
Me.DataGrid1.BackgroundColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.CaptionBackColor = System.Drawing.SystemColors.ControlDarkDark
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(40, 160)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(384, 64)
Me.DataGrid1.TabIndex = 5
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "奖惩", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("编号1", "编号1"), New System.Data.Common.DataColumnMapping("金额", "金额"), New System.Data.Common.DataColumnMapping("内容", "内容")})})
Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "DELETE FROM 奖惩 WHERE (编号1 = @Original_编号1) AND (金额 = @Original_金额 OR @Original_金额" & _
" IS NULL AND 金额 IS NULL)"
Me.SqlDeleteCommand1.Connection = Me.SqlConnection1
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_编号1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "编号1", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_金额", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "金额", System.Data.DataRowVersion.Original, Nothing))
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation id=FB60FF2059274FF;packet size=4096;integrated security=SSPI;initial " & _
"catalog=人事管理系统;persist security info=False"
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO 奖惩(编号1, 金额, 内容) VALUES (@编号1, @金额, @内容); SELECT 编号1, 金额, 内容 FROM 奖惩 W" & _
"HERE (编号1 = @编号1)"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@编号1", System.Data.SqlDbType.VarChar, 50, "编号1"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@金额", System.Data.SqlDbType.Money, 8, "金额"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@内容", System.Data.SqlDbType.VarChar, 2147483647, "内容"))
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT 编号1, 金额, 内容 FROM 奖惩"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "UPDATE 奖惩 SET 编号1 = @编号1, 金额 = @金额, 内容 = @内容 WHERE (编号1 = @Original_编号1) AND (金额 " & _
"= @Original_金额 OR @Original_金额 IS NULL AND 金额 IS NULL); SELECT 编号1, 金额, 内容 FROM " & _
"奖惩 WHERE (编号1 = @编号1)"
Me.SqlUpdateCommand1.Connection = Me.SqlConnection1
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@编号1", System.Data.SqlDbType.VarChar, 50, "编号1"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@金额", System.Data.SqlDbType.Money, 8, "金额"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@内容", System.Data.SqlDbType.VarChar, 2147483647, "内容"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_编号1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "编号1", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_金额", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "金额", System.Data.DataRowVersion.Original, Nothing))
'
'DataSet71
'
Me.DataSet71.DataSetName = "DataSet7"
Me.DataSet71.Locale = New System.Globalization.CultureInfo("zh-CN")
'
'Form4
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
Me.ClientSize = New System.Drawing.Size(456, 302)
Me.Controls.Add(Me.DataGrid1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Cursor = System.Windows.Forms.Cursors.Hand
Me.Name = "Form4"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataSet71, 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
TextBox1.Clear()
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataSet71.Clear()
SqlDataAdapter1.Fill(DataSet71, "奖惩")
DataGrid1.SetDataBinding(DataSet71, "奖惩")
Dim dv As DataView = New DataView(DataSet71.Tables("奖惩"))
Dim t As String = TextBox1.Text
Dim t1 As String = "'"
Dim t2 As String = "'"
dv.RowFilter = "编号1=" & t1 & t & t2
DataGrid1.SetDataBinding(dv, "")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -