📄 courseelect2.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 教务管理系统1
{
/// <summary>
/// CourseElect2 的摘要说明。
/// </summary>
public class CourseElect2 : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Button button1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlDataAdapter da1;
private 教务管理系统1.DataSet1 dataSet11;
private System.Windows.Forms.TextBox txt1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Data.SqlClient.SqlDataAdapter da2;
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
private System.Data.SqlClient.SqlCommand sqlInsertCommand2;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private 教务管理系统1.DataSet8 dataSet81;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txt2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CourseElect2()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txt1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet11 = new 教务管理系统1.DataSet1();
this.da1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.dataSet81 = new 教务管理系统1.DataSet8();
this.da2 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.label1 = new System.Windows.Forms.Label();
this.txt2 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet81)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txt2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.dateTimePicker2);
this.groupBox1.Controls.Add(this.dateTimePicker1);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.txt1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Location = new System.Drawing.Point(16, 264);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(232, 152);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// dateTimePicker2
//
this.dateTimePicker2.Location = new System.Drawing.Point(104, 120);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.Size = new System.Drawing.Size(112, 21);
this.dateTimePicker2.TabIndex = 9;
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(104, 88);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(112, 21);
this.dateTimePicker1.TabIndex = 8;
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 120);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 23);
this.label4.TabIndex = 7;
this.label4.Text = "上课结束日期";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 23);
this.label3.TabIndex = 6;
this.label3.Text = "上课起始日期";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txt1
//
this.txt1.Location = new System.Drawing.Point(104, 16);
this.txt1.Name = "txt1";
this.txt1.TabIndex = 1;
this.txt1.Text = "";
this.txt1.TextChanged += new System.EventHandler(this.txt2_TextChanged);
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 5;
this.label2.Text = "班级名称";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.DataSource = this.dataSet11.选课表;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(16, 56);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(536, 208);
this.dataGrid1.TabIndex = 1;
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// da1
//
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("上课结束日期", "上课结束日期")})});
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO 选课表(学号, 课程号, 成绩, 上课起始日期, 上课结束日期) VALUES (@学号, @课程号, @成绩, @上课起始日期, @上课" +
"结束日期); SELECT 学号, 课程号, 成绩, 上课起始日期, 上课结束日期 FROM 选课表";
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, 8, "课程号"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -