📄 selectcour.cs
字号:
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("课程编号", "课程编号")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=3366359E777E4EE;packet size=4096;integrated security=SSPI;data sou" +
"rce=3366359E777E4EE;persist security info=False;initial catalog=jiaoshi";
//
// button1
//
this.button1.Location = new System.Drawing.Point(312, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 4;
this.button1.Text = "查询";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox2
//
this.textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "选课信息表.学号"));
this.textBox2.Location = new System.Drawing.Point(104, 32);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 5;
this.textBox2.Text = "";
//
// textBox3
//
this.textBox3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "选课信息表.课程编号"));
this.textBox3.Location = new System.Drawing.Point(104, 64);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 6;
this.textBox3.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 7;
this.label2.Text = "学号";
//
// label3
//
this.label3.Location = new System.Drawing.Point(24, 64);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 23);
this.label3.TabIndex = 8;
this.label3.Text = "课程编号";
//
// label4
//
this.label4.Location = new System.Drawing.Point(24, 104);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 23);
this.label4.TabIndex = 9;
this.label4.Text = "序号";
//
// textBox4
//
this.textBox4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "选课信息表.序号"));
this.textBox4.Location = new System.Drawing.Point(104, 104);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 10;
this.textBox4.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(216, 96);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(104, 32);
this.label5.TabIndex = 11;
this.label5.Text = "序号为任意的整数,但是不能重复";
//
// dataGrid2
//
this.dataGrid2.DataMember = "课程基本信息";
this.dataGrid2.DataSource = this.dataSet71;
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(8, 320);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.ReadOnly = true;
this.dataGrid2.Size = new System.Drawing.Size(496, 144);
this.dataGrid2.TabIndex = 12;
//
// dataSet71
//
this.dataSet71.DataSetName = "DataSet7";
this.dataSet71.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.DeleteCommand = this.sqlDeleteCommand2;
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.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.sqlDataAdapter2.UpdateCommand = this.sqlUpdateCommand2;
//
// sqlDeleteCommand2
//
this.sqlDeleteCommand2.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)";
this.sqlDeleteCommand2.Connection = this.sqlConnection1;
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_课程编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "课程编号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.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.sqlDeleteCommand2.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.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开课教师", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开课教师", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开课系别", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开课系别", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_课程名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "课程名称", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO 课程基本信息(课程编号, 课程名称, 开课教师, 学分, 开课系别, 学时) VALUES (@课程编号, @课程名称, @开课教师, @" +
"学分, @开课系别, @学时); SELECT 课程编号, 课程名称, 开课教师, 学分, 开课系别, 学时 FROM 课程基本信息 WHERE (课程编号 =" +
" @课程编号)";
this.sqlInsertCommand2.Connection = this.sqlConnection1;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@课程编号", System.Data.SqlDbType.VarChar, 10, "课程编号"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@课程名称", System.Data.SqlDbType.VarChar, 10, "课程名称"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开课教师", System.Data.SqlDbType.VarChar, 10, "开课教师"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学分", System.Data.SqlDbType.Int, 4, "学分"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开课系别", System.Data.SqlDbType.VarChar, 10, "开课系别"));
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学时", System.Data.SqlDbType.Int, 4, "学时"));
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 课程编号, 课程名称, 开课教师, 学分, 开课系别, 学时 FROM 课程基本信息 WHERE (课程编号 LIKE @a) AND (课程名称 " +
"LIKE @b)";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@a", System.Data.SqlDbType.VarChar, 10, "课程编号"));
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@b", System.Data.SqlDbType.VarChar, 10, "课程名称"));
//
// sqlUpdateCommand2
//
this.sqlUpdateCommand2.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.sqlUpdateCommand2.Connection = this.sqlConnection1;
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@课程编号", System.Data.SqlDbType.VarChar, 10, "课程编号"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@课程名称", System.Data.SqlDbType.VarChar, 10, "课程名称"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开课教师", System.Data.SqlDbType.VarChar, 10, "开课教师"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学分", System.Data.SqlDbType.Int, 4, "学分"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@开课系别", System.Data.SqlDbType.VarChar, 10, "开课系别"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学时", System.Data.SqlDbType.Int, 4, "学时"));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_课程编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "课程编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.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.sqlUpdateCommand2.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.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开课教师", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开课教师", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_开课系别", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "开课系别", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_课程名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "课程名称", System.Data.DataRowVersion.Original, null));
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(64, 24);
this.label6.TabIndex = 13;
this.label6.Text = "课程编号";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(104, 32);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(80, 21);
this.textBox5.TabIndex = 14;
this.textBox5.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 80);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 24);
this.label7.TabIndex = 15;
this.label7.Text = "课程名称";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(104, 80);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(80, 21);
this.textBox6.TabIndex = 16;
this.textBox6.Text = "";
//
// button2
//
this.button2.Location = new System.Drawing.Point(544, 448);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 24);
this.button2.TabIndex = 17;
this.button2.Text = "查询";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label8
//
this.label8.Location = new System.Drawing.Point(416, 288);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(120, 24);
this.label8.TabIndex = 18;
this.label8.Text = "选好后请按保存";
//
// label9
//
this.label9.Location = new System.Drawing.Point(16, 288);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(376, 16);
this.label9.TabIndex = 19;
this.label9.Text = "请在下面的表中选择你要选的课,然后把课程编号填上面的选课框上";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBox4);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Location = new System.Drawing.Point(336, 120);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(352, 144);
this.groupBox1.TabIndex = 20;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "选课框";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.textBox5);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.textBox6);
this.groupBox2.Location = new System.Drawing.Point(528, 328);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(216, 120);
this.groupBox2.TabIndex = 21;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询";
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 序号, 学号, 课程编号 FROM 选课信息表 WHERE (学号 LIKE @Param2)";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param2", System.Data.SqlDbType.VarChar, 16, "学号"));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO 选课信息表(序号, 学号, 课程编号) VALUES (@序号, @学号, @课程编号); SELECT 序号, 学号, 课程编号 FRO" +
"M 选课信息表 WHERE (序号 = @序号)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@序号", System.Data.SqlDbType.VarChar, 10, "序号"));
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.VarChar, 10, "课程编号"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -