📄 orginfo.cs
字号:
this.帐号.HeaderText = "帐号";
this.帐号.MappingName = "帐号";
this.帐号.NullText = "";
this.帐号.Width = 75;
//
// 开户全称
//
this.开户全称.Format = "";
this.开户全称.FormatInfo = null;
this.开户全称.HeaderText = "开户全称";
this.开户全称.MappingName = "开户全称";
this.开户全称.NullText = "";
this.开户全称.Width = 75;
//
// toolBar1
//
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.tbarBtnSave,
this.toolBarQuit});
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Location = new System.Drawing.Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(568, 41);
this.toolBar1.TabIndex = 24;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// tbarBtnSave
//
this.tbarBtnSave.ImageIndex = 0;
this.tbarBtnSave.Text = "保存修改";
this.tbarBtnSave.ToolTipText = "保存修改";
//
// toolBarQuit
//
this.toolBarQuit.ImageIndex = 1;
this.toolBarQuit.Text = "退出";
this.toolBarQuit.ToolTipText = "退出";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "组织机构编码表", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("单位名称", "单位名称"),
new System.Data.Common.DataColumnMapping("拼音编码", "拼音编码"),
new System.Data.Common.DataColumnMapping("单位地址", "单位地址"),
new System.Data.Common.DataColumnMapping("单位电话号码", "单位电话号码"),
new System.Data.Common.DataColumnMapping("开户银行", "开户银行"),
new System.Data.Common.DataColumnMapping("帐号", "帐号"),
new System.Data.Common.DataColumnMapping("开户全称", "开户全称"),
new System.Data.Common.DataColumnMapping("单位编号", "单位编号")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM 组织机构编码表 WHERE (单位编号 = @Original_单位编号) AND (单位名称 = @Original_单位名称 OR @Original_单位名称 IS NULL AND 单位名称 IS NULL) AND (单位地址 = @Original_单位地址 OR @Original_单位地址 IS NULL AND 单位地址 IS NULL) AND (单位电话号码 = @Original_单位电话号码 OR @Original_单位电话号码 IS NULL AND 单位电话号码 IS NULL) AND (帐号 = @Original_帐号 OR @Original_帐号 IS NULL AND 帐号 IS NULL) AND (开户全称 = @Original_开户全称 OR @Original_开户全称 IS NULL AND 开户全称 IS NULL) AND (开户银行 = @Original_开户银行 OR @Original_开户银行 IS NULL AND 开户银行 IS NULL) AND (拼音编码 = @Original_拼音编码 OR @Original_拼音编码 IS NULL AND 拼音编码 IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位编号", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位编号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位名称", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位名称", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位地址", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位地址", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位电话号码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位电话号码", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_帐号", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "帐号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开户全称", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开户全称", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开户银行", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开户银行", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_拼音编码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "拼音编码", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=hrmbook;";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO 组织机构编码表(单位名称, 拼音编码, 单位地址, 单位电话号码, 开户银行, 帐号, 开户全称, 单位编号) VALUES (@单位名称" +
", @拼音编码, @单位地址, @单位电话号码, @开户银行, @帐号, @开户全称, @单位编号); SELECT 单位名称, 拼音编码, 单位地址, 单位电" +
"话号码, 开户银行, 帐号, 开户全称, 单位编号 FROM 组织机构编码表 WHERE (单位编号 = @单位编号)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位名称", System.Data.SqlDbType.VarChar, 100, "单位名称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@拼音编码", System.Data.SqlDbType.VarChar, 50, "拼音编码"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位地址", System.Data.SqlDbType.VarChar, 100, "单位地址"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位电话号码", System.Data.SqlDbType.VarChar, 50, "单位电话号码"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开户银行", System.Data.SqlDbType.VarChar, 100, "开户银行"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@帐号", System.Data.SqlDbType.VarChar, 50, "帐号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开户全称", System.Data.SqlDbType.VarChar, 100, "开户全称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位编号", System.Data.SqlDbType.VarChar, 20, "单位编号"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 单位名称, 拼音编码, 单位地址, 单位电话号码, 开户银行, 帐号, 开户全称, 单位编号 FROM 组织机构编码表";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE 组织机构编码表 SET 单位名称 = @单位名称, 拼音编码 = @拼音编码, 单位地址 = @单位地址, 单位电话号码 = @单位电话号码, 开户银行 = @开户银行, 帐号 = @帐号, 开户全称 = @开户全称, 单位编号 = @单位编号 WHERE (单位编号 = @Original_单位编号) AND (单位名称 = @Original_单位名称 OR @Original_单位名称 IS NULL AND 单位名称 IS NULL) AND (单位地址 = @Original_单位地址 OR @Original_单位地址 IS NULL AND 单位地址 IS NULL) AND (单位电话号码 = @Original_单位电话号码 OR @Original_单位电话号码 IS NULL AND 单位电话号码 IS NULL) AND (帐号 = @Original_帐号 OR @Original_帐号 IS NULL AND 帐号 IS NULL) AND (开户全称 = @Original_开户全称 OR @Original_开户全称 IS NULL AND 开户全称 IS NULL) AND (开户银行 = @Original_开户银行 OR @Original_开户银行 IS NULL AND 开户银行 IS NULL) AND (拼音编码 = @Original_拼音编码 OR @Original_拼音编码 IS NULL AND 拼音编码 IS NULL); SELECT 单位名称, 拼音编码, 单位地址, 单位电话号码, 开户银行, 帐号, 开户全称, 单位编号 FROM 组织机构编码表 WHERE (单位编号 = @单位编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位名称", System.Data.SqlDbType.VarChar, 100, "单位名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@拼音编码", System.Data.SqlDbType.VarChar, 50, "拼音编码"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位地址", System.Data.SqlDbType.VarChar, 100, "单位地址"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位电话号码", System.Data.SqlDbType.VarChar, 50, "单位电话号码"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开户银行", System.Data.SqlDbType.VarChar, 100, "开户银行"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@帐号", System.Data.SqlDbType.VarChar, 50, "帐号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开户全称", System.Data.SqlDbType.VarChar, 100, "开户全称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@单位编号", System.Data.SqlDbType.VarChar, 20, "单位编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位编号", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位名称", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位名称", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位地址", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位地址", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_单位电话号码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "单位电话号码", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_帐号", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "帐号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开户全称", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开户全称", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开户银行", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开户银行", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_拼音编码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "拼音编码", System.Data.DataRowVersion.Original, null));
//
// OrgInfo
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(568, 397);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.toolBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "OrgInfo";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "【机构详细信息】";
this.Load += new System.EventHandler(this.OrgInfo_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
}
#endregion
//--------------初始化时,读入组织机构的信息------------------
private void OrgInfo_Load(object sender, System.EventArgs e)
{
this.sqlDataAdapter1.Fill(this.dataSet11.组织机构编码表);
}
//--------------遍历整个数据表,保存所有修改------------------
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(e.Button.ToolTipText == "保存修改")//保存所作的修改
{
try
{
if (this.dataSet11.组织机构编码表.GetChanges() != null)
{
this.sqlDataAdapter1.Update(this.dataSet11);
MessageBox.Show("数据保存成功!","信息");
}
else
{
MessageBox.Show("没有修改任何数据!","信息");
}
}
catch
{
MessageBox.Show("数据修改失败,请重试!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
}
if (e.Button.ToolTipText == "退出")//退出窗体
{
this.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -