📄 editing.vb
字号:
Public Class frmEditing
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Me.daEmployeeList.Fill(Me.dsEmployeeList1.EmployeeList)
UpdateDisplay()
End Sub
'Form overrides dispose to clean up the component list.
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
Friend WithEvents daEmployeeList As System.Data.SqlClient.SqlDataAdapter
Friend WithEvents cmdSelectEmployees As System.Data.SqlClient.SqlCommand
Friend WithEvents cmdInsertEmployees As System.Data.SqlClient.SqlCommand
Friend WithEvents cnNorthwind As System.Data.SqlClient.SqlConnection
Friend WithEvents cmdDeleteEmployees As System.Data.SqlClient.SqlCommand
Friend WithEvents cmdUpdateEmployees As System.Data.SqlClient.SqlCommand
Friend WithEvents dsEmployeeList1 As Editing.dsEmployeeList
Friend WithEvents Panel1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtOriginalID As System.Windows.Forms.TextBox
Friend WithEvents txtCurrentID As System.Windows.Forms.TextBox
Friend WithEvents txtOriginalFirstName As System.Windows.Forms.TextBox
Friend WithEvents txtCurrentFirstName As System.Windows.Forms.TextBox
Friend WithEvents txtOriginalLastName As System.Windows.Forms.TextBox
Friend WithEvents txtCurrentLastName As System.Windows.Forms.TextBox
Friend WithEvents gbRowStatus As System.Windows.Forms.GroupBox
Friend WithEvents rbNew As System.Windows.Forms.RadioButton
Friend WithEvents rbDeleted As System.Windows.Forms.RadioButton
Friend WithEvents rbUnchanged As System.Windows.Forms.RadioButton
Friend WithEvents rbChanged As System.Windows.Forms.RadioButton
Friend WithEvents btnFirst As System.Windows.Forms.Button
Friend WithEvents btnPrevious As System.Windows.Forms.Button
Friend WithEvents btnLast As System.Windows.Forms.Button
Friend WithEvents btnNext As System.Windows.Forms.Button
Friend WithEvents txtPosition As System.Windows.Forms.TextBox
Friend WithEvents txtWorkingID As System.Windows.Forms.TextBox
Friend WithEvents txtWorkingLastName As System.Windows.Forms.TextBox
Friend WithEvents txtWorkingFirstName As System.Windows.Forms.TextBox
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents btnLoad As System.Windows.Forms.Button
Friend WithEvents btnUpdate As System.Windows.Forms.Button
Friend WithEvents btnAccept As System.Windows.Forms.Button
Friend WithEvents btnDelete As System.Windows.Forms.Button
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents btnEdit As System.Windows.Forms.Button
Friend WithEvents btnDefer As System.Windows.Forms.Button
Friend WithEvents btnCmd As System.Windows.Forms.Button
Friend WithEvents btnReject As System.Windows.Forms.Button
Friend WithEvents btnFill As System.Windows.Forms.Button
'Required by the Windows Form Designer
Private components As System.ComponentModel.Container
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label5 = New System.Windows.Forms.Label()
Me.txtPosition = New System.Windows.Forms.TextBox()
Me.rbUnchanged = New System.Windows.Forms.RadioButton()
Me.txtWorkingLastName = New System.Windows.Forms.TextBox()
Me.dsEmployeeList1 = New Editing.dsEmployeeList()
Me.rbNew = New System.Windows.Forms.RadioButton()
Me.btnDelete = New System.Windows.Forms.Button()
Me.btnLast = New System.Windows.Forms.Button()
Me.txtOriginalLastName = New System.Windows.Forms.TextBox()
Me.cmdSelectEmployees = New System.Data.SqlClient.SqlCommand()
Me.cnNorthwind = New System.Data.SqlClient.SqlConnection()
Me.btnAccept = New System.Windows.Forms.Button()
Me.cmdDeleteEmployees = New System.Data.SqlClient.SqlCommand()
Me.daEmployeeList = New System.Data.SqlClient.SqlDataAdapter()
Me.cmdInsertEmployees = New System.Data.SqlClient.SqlCommand()
Me.cmdUpdateEmployees = New System.Data.SqlClient.SqlCommand()
Me.txtCurrentLastName = New System.Windows.Forms.TextBox()
Me.txtOriginalFirstName = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.rbChanged = New System.Windows.Forms.RadioButton()
Me.btnFirst = New System.Windows.Forms.Button()
Me.btnAdd = New System.Windows.Forms.Button()
Me.btnNext = New System.Windows.Forms.Button()
Me.Panel1 = New System.Windows.Forms.GroupBox()
Me.gbRowStatus = New System.Windows.Forms.GroupBox()
Me.txtCurrentFirstName = New System.Windows.Forms.TextBox()
Me.txtCurrentID = New System.Windows.Forms.TextBox()
Me.txtOriginalID = New System.Windows.Forms.TextBox()
Me.btnUpdate = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.btnPrevious = New System.Windows.Forms.Button()
Me.txtWorkingID = New System.Windows.Forms.TextBox()
Me.btnEdit = New System.Windows.Forms.Button()
Me.btnCmd = New System.Windows.Forms.Button()
Me.btnDefer = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.txtWorkingFirstName = New System.Windows.Forms.TextBox()
Me.btnReject = New System.Windows.Forms.Button()
Me.btnFill = New System.Windows.Forms.Button()
CType(Me.dsEmployeeList1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
Me.gbRowStatus.SuspendLayout()
Me.SuspendLayout()
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.Location = New System.Drawing.Point(8, 84)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(64, 13)
Me.Label5.TabIndex = 9
Me.Label5.Text = "Last Name:"
'
'txtPosition
'
Me.txtPosition.Location = New System.Drawing.Point(88, 273)
Me.txtPosition.Name = "txtPosition"
Me.txtPosition.Size = New System.Drawing.Size(168, 20)
Me.txtPosition.TabIndex = 7
Me.txtPosition.TabStop = False
Me.txtPosition.Text = "Position"
'
'rbUnchanged
'
Me.rbUnchanged.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rbUnchanged.Location = New System.Drawing.Point(16, 24)
Me.rbUnchanged.Name = "rbUnchanged"
Me.rbUnchanged.Size = New System.Drawing.Size(80, 16)
Me.rbUnchanged.TabIndex = 20
Me.rbUnchanged.Text = "Unchanged"
'
'txtWorkingLastName
'
Me.txtWorkingLastName.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.dsEmployeeList1, "EmployeeList.LastName"))
Me.txtWorkingLastName.Location = New System.Drawing.Point(88, 80)
Me.txtWorkingLastName.Name = "txtWorkingLastName"
Me.txtWorkingLastName.TabIndex = 1
Me.txtWorkingLastName.Text = "Working Last"
'
'dsEmployeeList1
'
Me.dsEmployeeList1.DataSetName = "dsEmployeeList"
Me.dsEmployeeList1.Locale = New System.Globalization.CultureInfo("en-US")
Me.dsEmployeeList1.Namespace = "http://www.tempuri.org/dsEmployeeList.xsd"
'
'rbNew
'
Me.rbNew.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rbNew.Location = New System.Drawing.Point(200, 24)
Me.rbNew.Name = "rbNew"
Me.rbNew.Size = New System.Drawing.Size(48, 16)
Me.rbNew.TabIndex = 0
Me.rbNew.Text = "New"
'
'btnDelete
'
Me.btnDelete.Location = New System.Drawing.Point(360, 66)
Me.btnDelete.Name = "btnDelete"
Me.btnDelete.TabIndex = 5
Me.btnDelete.Text = "Delete"
'
'btnLast
'
Me.btnLast.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnLast.Location = New System.Drawing.Point(304, 272)
Me.btnLast.Name = "btnLast"
Me.btnLast.Size = New System.Drawing.Size(32, 23)
Me.btnLast.TabIndex = 10
Me.btnLast.TabStop = False
Me.btnLast.Text = ">>"
'
'txtOriginalLastName
'
Me.txtOriginalLastName.Location = New System.Drawing.Point(208, 24)
Me.txtOriginalLastName.Name = "txtOriginalLastName"
Me.txtOriginalLastName.ReadOnly = True
Me.txtOriginalLastName.TabIndex = 4
Me.txtOriginalLastName.TabStop = False
Me.txtOriginalLastName.Text = "Original Last"
'
'cmdSelectEmployees
'
Me.cmdSelectEmployees.CommandText = "SELECT EmployeeID, FirstName, LastName FROM Employees ORDER BY LastName"
Me.cmdSelectEmployees.Connection = Me.cnNorthwind
'
'cnNorthwind
'
Me.cnNorthwind.ConnectionString = "data source=localhost;initial catalog=nwind;integrated security=SSPI;persist " & _
"security info=False;packet size=4096"
'
'btnAccept
'
Me.btnAccept.Location = New System.Drawing.Point(360, 246)
Me.btnAccept.Name = "btnAccept"
Me.btnAccept.TabIndex = 10
Me.btnAccept.Text = "Accept"
'
'cmdDeleteEmployees
'
Me.cmdDeleteEmployees.CommandText = "DELETE FROM Employees WHERE (EmployeeID = @empID)"
Me.cmdDeleteEmployees.Connection = Me.cnNorthwind
Me.cmdDeleteEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@empID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EmployeeID", System.Data.DataRowVersion.Current, Nothing))
'
'daEmployeeList
'
Me.daEmployeeList.DeleteCommand = Me.cmdDeleteEmployees
Me.daEmployeeList.InsertCommand = Me.cmdInsertEmployees
Me.daEmployeeList.SelectCommand = Me.cmdSelectEmployees
Me.daEmployeeList.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "EmployeeList", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), New System.Data.Common.DataColumnMapping("FirstName", "FirstName"), New System.Data.Common.DataColumnMapping("LastName", "LastName")})})
Me.daEmployeeList.UpdateCommand = Me.cmdUpdateEmployees
'
'cmdInsertEmployees
'
Me.cmdInsertEmployees.CommandText = "INSERT INTO Employees (FirstName, LastName) VALUES (@FirstName, @LastName)"
Me.cmdInsertEmployees.Connection = Me.cnNorthwind
Me.cmdInsertEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@FirstName", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "FirstName", System.Data.DataRowVersion.Current, Nothing))
Me.cmdInsertEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LastName", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "LastName", System.Data.DataRowVersion.Current, Nothing))
'
'cmdUpdateEmployees
'
Me.cmdUpdateEmployees.CommandText = "UPDATE Employees SET FirstName = @first, LastName = @last WHERE (EmployeeID = @em" & _
"pID)"
Me.cmdUpdateEmployees.Connection = Me.cnNorthwind
Me.cmdUpdateEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@first", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "FirstName", System.Data.DataRowVersion.Current, Nothing))
Me.cmdUpdateEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@last", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "LastName", System.Data.DataRowVersion.Current, Nothing))
Me.cmdUpdateEmployees.Parameters.Add(New System.Data.SqlClient.SqlParameter("@empID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EmployeeID", System.Data.DataRowVersion.Current, Nothing))
'
'txtCurrentLastName
'
Me.txtCurrentLastName.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.dsEmployeeList1, "EmployeeList.LastName"))
Me.txtCurrentLastName.Location = New System.Drawing.Point(208, 48)
Me.txtCurrentLastName.Name = "txtCurrentLastName"
Me.txtCurrentLastName.ReadOnly = True
Me.txtCurrentLastName.TabIndex = 5
Me.txtCurrentLastName.TabStop = False
Me.txtCurrentLastName.Text = "Current Last"
'
'txtOriginalFirstName
'
Me.txtOriginalFirstName.Location = New System.Drawing.Point(104, 24)
Me.txtOriginalFirstName.Name = "txtOriginalFirstName"
Me.txtOriginalFirstName.ReadOnly = True
Me.txtOriginalFirstName.TabIndex = 2
Me.txtOriginalFirstName.TabStop = False
Me.txtOriginalFirstName.Text = "Original First"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 28)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(49, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Original:"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(8, 52)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(47, 13)
Me.Label2.TabIndex = 0
Me.Label2.Text = "Current:"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(8, 20)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 13)
Me.Label3.TabIndex = 9
Me.Label3.Text = "EmployeeID:"
'
'rbChanged
'
Me.rbChanged.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rbChanged.Location = New System.Drawing.Point(112, 24)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -