📄 deleteemployee.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using RemotingClass;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels;
namespace Login
{
/// <summary>
/// DeleteEmployee 的摘要说明。
/// </summary>
public class DeleteEmployee : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbID;
private System.Windows.Forms.Button btDelete;
private System.Windows.Forms.Button btExit;
private System.Data.SqlClient.SqlConnection sqlConnection_Staff;
private System.Data.DataSet dataSet_Staff;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter_Staff;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter_Branch;
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
private System.Data.SqlClient.SqlCommand sqlInsertCommand2;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand2;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand2;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public DeleteEmployee()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DeleteEmployee));
this.label1 = new System.Windows.Forms.Label();
this.tbID = new System.Windows.Forms.TextBox();
this.btDelete = new System.Windows.Forms.Button();
this.btExit = new System.Windows.Forms.Button();
this.sqlConnection_Staff = new System.Data.SqlClient.SqlConnection();
this.dataSet_Staff = new System.Data.DataSet();
this.sqlDataAdapter_Staff = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDataAdapter_Branch = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
((System.ComponentModel.ISupportInitialize)(this.dataSet_Staff)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(72, 72);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 16);
this.label1.TabIndex = 0;
this.label1.Text = "员工ID:";
//
// tbID
//
this.tbID.Location = new System.Drawing.Point(128, 64);
this.tbID.Name = "tbID";
this.tbID.TabIndex = 1;
this.tbID.Text = "";
//
// btDelete
//
this.btDelete.Location = new System.Drawing.Point(56, 184);
this.btDelete.Name = "btDelete";
this.btDelete.TabIndex = 2;
this.btDelete.Text = "删除";
this.btDelete.Click += new System.EventHandler(this.btDelete_Click);
//
// btExit
//
this.btExit.Location = new System.Drawing.Point(176, 184);
this.btExit.Name = "btExit";
this.btExit.TabIndex = 3;
this.btExit.Text = "退出";
this.btExit.Click += new System.EventHandler(this.btExit_Click);
//
// sqlConnection_Staff
//
this.sqlConnection_Staff.ConnectionString = "workstation id=7B1EE60547FB453;packet size=4096;user id=sa;integrated security=SS" +
"PI;initial catalog=Center;persist security info=False";
//
// dataSet_Staff
//
this.dataSet_Staff.DataSetName = "NewDataSet";
this.dataSet_Staff.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlDataAdapter_Staff
//
this.sqlDataAdapter_Staff.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter_Staff.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter_Staff.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter_Staff.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Staff", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("staffid", "staffid"),
new System.Data.Common.DataColumnMapping("branch", "branch"),
new System.Data.Common.DataColumnMapping("branchid", "branchid"),
new System.Data.Common.DataColumnMapping("staffname", "staffname"),
new System.Data.Common.DataColumnMapping("gender", "gender"),
new System.Data.Common.DataColumnMapping("staffkind", "staffkind"),
new System.Data.Common.DataColumnMapping("salary", "salary"),
new System.Data.Common.DataColumnMapping("staffphone", "staffphone")})});
this.sqlDataAdapter_Staff.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDataAdapter_Branch
//
this.sqlDataAdapter_Branch.DeleteCommand = this.sqlDeleteCommand2;
this.sqlDataAdapter_Branch.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter_Branch.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter_Branch.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Branch", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("branchid", "branchid"),
new System.Data.Common.DataColumnMapping("sever", "sever"),
new System.Data.Common.DataColumnMapping("db", "db"),
new System.Data.Common.DataColumnMapping("ip", "ip")})});
this.sqlDataAdapter_Branch.UpdateCommand = this.sqlUpdateCommand2;
//
// sqlDeleteCommand2
//
this.sqlDeleteCommand2.CommandText = @"DELETE FROM Branch WHERE (branchid = @Original_branchid) AND (db = @Original_db OR @Original_db IS NULL AND db IS NULL) AND (ip = @Original_ip OR @Original_ip IS NULL AND ip IS NULL) AND (sever = @Original_sever OR @Original_sever IS NULL AND sever IS NULL)";
this.sqlDeleteCommand2.Connection = this.sqlConnection_Staff;
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_branchid", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "branchid", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_db", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "db", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ip", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ip", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_sever", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "sever", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO Branch(branchid, sever, db, ip) VALUES (@branchid, @sever, @db, @ip);" +
" SELECT branchid, sever, db, ip FROM Branch WHERE (branchid = @branchid)";
this.sqlInsertCommand2.Connection = this.sqlConnection_Staff;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -