📄 frmstudent.cs
字号:
//
// cbbSex
//
this.cbbSex.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "学生信息.性别"));
this.cbbSex.Items.AddRange(new object[] {
"男",
"女"});
this.cbbSex.Location = new System.Drawing.Point(208, 32);
this.cbbSex.Name = "cbbSex";
this.cbbSex.Size = new System.Drawing.Size(64, 20);
this.cbbSex.TabIndex = 27;
//
// Label13
//
this.Label13.Location = new System.Drawing.Point(208, 16);
this.Label13.Name = "Label13";
this.Label13.Size = new System.Drawing.Size(56, 16);
this.Label13.TabIndex = 26;
this.Label13.Text = "性别";
//
// txbPID
//
this.txbPID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "学生信息.身份证号"));
this.txbPID.Location = new System.Drawing.Point(360, 32);
this.txbPID.Name = "txbPID";
this.txbPID.Size = new System.Drawing.Size(96, 21);
this.txbPID.TabIndex = 25;
this.txbPID.Text = "";
//
// Label7
//
this.Label7.Location = new System.Drawing.Point(360, 16);
this.Label7.Name = "Label7";
this.Label7.Size = new System.Drawing.Size(56, 16);
this.Label7.TabIndex = 24;
this.Label7.Text = "身份证号";
//
// txbGrade
//
this.txbGrade.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "学生信息.年级"));
this.txbGrade.Location = new System.Drawing.Point(288, 32);
this.txbGrade.Name = "txbGrade";
this.txbGrade.Size = new System.Drawing.Size(56, 21);
this.txbGrade.TabIndex = 23;
this.txbGrade.Text = "";
//
// Label6
//
this.Label6.Location = new System.Drawing.Point(288, 16);
this.Label6.Name = "Label6";
this.Label6.Size = new System.Drawing.Size(56, 16);
this.Label6.TabIndex = 22;
this.Label6.Text = "年级";
//
// txbName
//
this.txbName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "学生信息.姓名"));
this.txbName.Location = new System.Drawing.Point(112, 32);
this.txbName.Name = "txbName";
this.txbName.Size = new System.Drawing.Size(80, 21);
this.txbName.TabIndex = 21;
this.txbName.Text = "";
//
// Label5
//
this.Label5.Location = new System.Drawing.Point(112, 16);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(56, 16);
this.Label5.TabIndex = 20;
this.Label5.Text = "姓名";
//
// txbClassId
//
this.txbClassId.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "学生信息.学号"));
this.txbClassId.Location = new System.Drawing.Point(16, 32);
this.txbClassId.Name = "txbClassId";
this.txbClassId.Size = new System.Drawing.Size(80, 21);
this.txbClassId.TabIndex = 19;
this.txbClassId.Text = "";
//
// Label4
//
this.Label4.Location = new System.Drawing.Point(16, 16);
this.Label4.Name = "Label4";
this.Label4.Size = new System.Drawing.Size(56, 16);
this.Label4.TabIndex = 18;
this.Label4.Text = "学号";
//
// 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("籍贯编号", "籍贯编号"),
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_学籍编号) 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_民族编号) AND (班级编号 = @Original_班级编号 OR @Original_班级编号 IS NULL AND 班级编号 IS NULL) AND (籍贯编号 = @Original_籍贯编号) 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, 14, 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, 8, 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, 2, 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.Int, 4, 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, 2, 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, 2, 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, 2, 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, 14, 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, 2, 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, 15, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "身份证号", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=ACER;packet size=4096;integrated security=SSPI;data source=Acer;pe" +
"rsist 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, 8, "姓名"));
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, 14, "班级编号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.VarChar, 2, "性别"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年级", System.Data.SqlDbType.Int, 4, "年级"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@政治面貌编号", System.Data.SqlDbType.VarChar, 2, "政治面貌编号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@民族编号", System.Data.SqlDbType.VarChar, 2, "民族编号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@籍贯编号", System.Data.SqlDbType.VarChar, 2, "籍贯编号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@身份证号", System.Data.SqlDbType.VarChar, 15, "身份证号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学籍编号", System.Data.SqlDbType.VarChar, 2, "学籍编号"));
//
// 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_学籍编号) 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_民族编号) AND (班级编号 = @Original_班级编号 OR @Original_班级编号 IS NULL AND 班级编号 IS NULL) AND (籍贯编号 = @Original_籍贯编号) 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, 8, "姓名"));
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, 14, "班级编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.VarChar, 2, "性别"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@年级", System.Data.SqlDbType.Int, 4, "年级"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@政治面貌编号", System.Data.SqlDbType.VarChar, 2, "政治面貌编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@民族编号", System.Data.SqlDbType.VarChar, 2, "民族编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@籍贯编号", System.Data.SqlDbType.VarChar, 2, "籍贯编号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@身份证号", System.Data.SqlDbType.VarChar, 15, "身份证号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学籍编号", System.Data.SqlDbType.VarChar, 2, "学籍编号"));
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.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, 2, 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.Int, 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, 2, 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, 2, 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, 2, 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, 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.VarChar, 2, 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, 15, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "身份证号", System.Data.DataRowVersion.Original, null));
//
// frmStudent
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(600, 373);
this.Controls.Add(this.GroupBox1);
this.Name = "frmStudent";
this.Controls.SetChildIndex(this.GroupBox1, 0);
this.GroupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
} #endregion public override void Prepare()
{
this.Text = "学生信息维护";
this.Label1.Text = "学号";
this.Label2.Text = "姓名";
this.Label3.Text = "年级";
DataBase db = new DataBase();
DataView dv = db.RunSelectSQL( "select 班级编号,班级名称 from 班级信息 order by 班级名称" );
this.cbbClassId.DataSource = dv;
this.cbbClassId.DisplayMember = "班级名称";
this.cbbClassId.ValueMember = "班级编号";
dv = db.RunSelectSQL( "select 政治面貌编号,政治面貌 from 政治面貌代码表" );
this.cbbPolity.DataSource = dv;
this.cbbPolity.DisplayMember = "政治面貌";
this.cbbPolity.ValueMember = "政治面貌编号";
dv = db.RunSelectSQL( "select 民族编号,民族 from 民族代码表" );
this.cbbNation.DataSource = dv;
this.cbbNation.DisplayMember = "民族";
this.cbbNation.ValueMember = "民族编号";
dv = db.RunSelectSQL( "select 籍贯编号,籍贯 from 籍贯代码表" );
this.cbbBirthPlace.DataSource = dv;
this.cbbBirthPlace.DisplayMember = "籍贯";
this.cbbBirthPlace.ValueMember = "籍贯编号";
dv = db.RunSelectSQL( "select 学籍编号,学籍名称 from 学籍代码表" );
this.cbbStatus.DataSource = dv;
this.cbbStatus.DisplayMember = "学籍名称";
this.cbbStatus.ValueMember = "学籍编号";
db.Dispose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -