📄 classinfo.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace 教务管理系统{ public class ClassInfo : 医院管理系统.ParentForm {
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private 教务管理系统.DataSet1 dataSet11;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txt4;
private System.Windows.Forms.TextBox txt5;
private System.Windows.Forms.TextBox txt6;
private System.Windows.Forms.TextBox txt9;
private System.Windows.Forms.TextBox txt8;
private System.Windows.Forms.TextBox txt7; private System.ComponentModel.IContainer components = null; public ClassInfo() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.dataSet11 = new 教务管理系统.DataSet1();
this.label4 = new System.Windows.Forms.Label();
this.txt4 = new System.Windows.Forms.TextBox();
this.txt5 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.txt6 = new System.Windows.Forms.TextBox();
this.txt9 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.txt8 = new System.Windows.Forms.TextBox();
this.txt7 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
//
// groupBox1
//
this.groupBox1.Name = "groupBox1";
//
// txt2
//
this.txt2.Name = "txt2";
//
// label1
//
this.label1.Name = "label1";
this.label1.Text = "年级";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnSearch
//
this.btnSearch.Name = "btnSearch";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// txt1
//
this.txt1.Name = "txt1";
//
// label2
//
this.label2.Name = "label2";
this.label2.Text = "班级编号";
//
// txt3
//
this.txt3.Name = "txt3";
//
// label3
//
this.label3.Name = "label3";
this.label3.Text = "班级名称";
//
// toolBar1
//
this.toolBar1.Name = "toolBar1";
this.toolBar1.Size = new System.Drawing.Size(728, 41);
//
// dataGrid1
//
this.dataGrid1.DataMember = "班级信息";
this.dataGrid1.DataSource = this.dataSet11;
this.dataGrid1.Name = "dataGrid1";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txt4);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.txt5);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txt6);
this.groupBox2.Controls.Add(this.txt9);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.txt8);
this.groupBox2.Controls.Add(this.txt7);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Name = "groupBox2";
//
// da1
//
this.da1.DeleteCommand = this.sqlDeleteCommand1;
this.da1.InsertCommand = this.sqlInsertCommand1;
this.da1.SelectCommand = this.sqlSelectCommand1;
this.da1.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("班主任", "班主任")})});
this.da1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 班级编号, 年级, 班级名称, 班级简称, 人数, 班主任 FROM 班级信息 WHERE (班级编号 LIKE @Param4) AND (年级 " +
"LIKE @Param5) AND (班级名称 LIKE @Param6)";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 14, "班级编号"));
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 4, "年级"));
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 30, "班级名称"));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;data source=\"." +
"\";persist security info=False;initial catalog=eisbook";
//
// 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, 14, "班级编号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年级", System.Data.SqlDbType.VarChar, 4, "年级"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班级名称", System.Data.SqlDbType.VarChar, 30, "班级名称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班级简称", System.Data.SqlDbType.VarChar, 16, "班级简称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@人数", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(3)), ((System.Byte)(0)), "人数", System.Data.DataRowVersion.Current, null));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班主任", System.Data.SqlDbType.VarChar, 8, "班主任"));
//
// 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); SELECT 班级编号, 年级, 班级名称, 班级简称, 人数, 班主任 FROM 班级信息 WHERE (班级编号 = @班级编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班级编号", System.Data.SqlDbType.VarChar, 14, "班级编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年级", System.Data.SqlDbType.VarChar, 4, "年级"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班级名称", System.Data.SqlDbType.VarChar, 30, "班级名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班级简称", System.Data.SqlDbType.VarChar, 16, "班级简称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@人数", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(3)), ((System.Byte)(0)), "人数", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@班主任", System.Data.SqlDbType.VarChar, 8, "班主任"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_班级编号", System.Data.SqlDbType.VarChar, 14, 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.Decimal, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(3)), ((System.Byte)(0)), "人数", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_年级", System.Data.SqlDbType.VarChar, 4, 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, 8, 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, 30, 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, 16, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "班级简称", System.Data.DataRowVersion.Original, null));
//
// sqlDeleteCommand1
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -