?? courseinfo.cs
字號:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data;using System.Data.SqlClient;namespace 教務管理系統{ public class CourseInfo : 醫院管理系統.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.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.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.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox txt10;
private System.Windows.Forms.ComboBox cmb1; private System.ComponentModel.IContainer components = null; public CourseInfo() { // 該調用是 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.txt4 = new System.Windows.Forms.TextBox();
this.txt5 = new System.Windows.Forms.TextBox();
this.txt6 = new System.Windows.Forms.TextBox();
this.txt9 = new System.Windows.Forms.TextBox();
this.txt8 = new System.Windows.Forms.TextBox();
this.txt7 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.txt10 = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.cmb1 = new System.Windows.Forms.ComboBox();
((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 = "課程名稱";
//
// 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.cmb1);
this.groupBox2.Controls.Add(this.txt4);
this.groupBox2.Controls.Add(this.txt5);
this.groupBox2.Controls.Add(this.txt6);
this.groupBox2.Controls.Add(this.txt9);
this.groupBox2.Controls.Add(this.txt8);
this.groupBox2.Controls.Add(this.txt7);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.txt10);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.label11);
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("教師", "教師"),
new System.Data.Common.DataColumnMapping("開課系別", "開課系別"),
new System.Data.Common.DataColumnMapping("學分", "學分")})});
this.da1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 課程編號, 課程名稱, 課程簡稱, 拼音碼, 本學期課程, 教師, 開課系別, 學分 FROM 課程信息 WHERE (課程編號 LIKE @Par" +
"am4) AND (課程名稱 LIKE @Param5) AND (拼音碼 LIKE @Param6)";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.Int, 4, "課程編號"));
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 40, "課程名稱"));
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 6, "拼音碼"));
//
// 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.Int, 4, "課程編號"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@課程名稱", System.Data.SqlDbType.VarChar, 40, "課程名稱"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@課程簡稱", System.Data.SqlDbType.VarChar, 40, "課程簡稱"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@拼音碼", System.Data.SqlDbType.VarChar, 6, "拼音碼"));
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, 10, "教師"));
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.Int, 4, "學分"));
//
// 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_本學期課程) AND (課程名稱 = @Original_課程名稱) AND (課程簡稱 = @Original_課程簡稱); SELECT 課程編號, 課程名稱, 課程簡稱, 拼音碼, 本學期課程, 教師, 開課系別, 學分 FROM 課程信息 WHERE (課程編號 = @課程編號)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
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, 40, "課程名稱"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@課程簡稱", System.Data.SqlDbType.VarChar, 40, "課程簡稱"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@拼音碼", System.Data.SqlDbType.VarChar, 6, "拼音碼"));
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, 10, "教師"));
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.Int, 4, "學分"));
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.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, 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, 6, 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, 10, 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, 40, 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, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "課程簡稱", System.Data.DataRowVersion.Original, null));
//
// 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_本學期課程) AND (課程名稱 = @Original_課程名稱) AND (課程簡稱 = @Original_課程簡稱)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
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.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, 30, 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, 6, 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, 10, 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, 40, 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, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "課程簡稱", System.Data.DataRowVersion.Original, null));
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// txt4
//
this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "課程信息.課程編號"));
this.txt4.Location = new System.Drawing.Point(88, 38);
this.txt4.Name = "txt4";
this.txt4.ReadOnly = true;
this.txt4.Size = new System.Drawing.Size(136, 21);
this.txt4.TabIndex = 10;
this.txt4.Text = "";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -