📄 modifyclass.cs
字号:
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.label2.Location = new System.Drawing.Point(47, 103);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(36, 21);
this.label2.TabIndex = 22;
this.label2.Text = "专业";
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox1.Location = new System.Drawing.Point(99, 51);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(170, 25);
this.textBox1.TabIndex = 21;
this.textBox1.Text = "";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.label1.Location = new System.Drawing.Point(13, 51);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(67, 21);
this.label1.TabIndex = 20;
this.label1.Text = "班级名称";
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Enabled = false;
this.comboBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.comboBox1.Location = new System.Drawing.Point(99, 103);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(170, 23);
this.comboBox1.TabIndex = 34;
//
// button2
//
this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button2.Location = new System.Drawing.Point(405, 298);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 31);
this.button2.TabIndex = 32;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button1.Location = new System.Drawing.Point(99, 298);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(74, 31);
this.button1.TabIndex = 31;
this.button1.Text = "修改";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// dateTimePicker1
//
this.dateTimePicker1.Enabled = false;
this.dateTimePicker1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.dateTimePicker1.Location = new System.Drawing.Point(365, 154);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(182, 25);
this.dateTimePicker1.TabIndex = 30;
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = "Data Source=xsxxdb.mdb;Jet OLEDB:Engine Type=5;Provider=Microsoft.Jet." +
"OLEDB.4.0;";
//
// label9
//
this.label9.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label9.ForeColor = System.Drawing.SystemColors.ControlText;
this.label9.Location = new System.Drawing.Point(472, 51);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(85, 21);
this.label9.TabIndex = 37;
this.label9.Text = "zymc";
this.label9.Visible = false;
//
// numericUpDown1
//
this.numericUpDown1.Enabled = false;
this.numericUpDown1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.numericUpDown1.Location = new System.Drawing.Point(365, 51);
this.numericUpDown1.Maximum = new System.Decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown1.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.ReadOnly = true;
this.numericUpDown1.Size = new System.Drawing.Size(96, 25);
this.numericUpDown1.TabIndex = 38;
this.numericUpDown1.Value = new System.Decimal(new int[] {
3,
0,
0,
0});
//
// ModifyClass
//
this.AutoScaleBaseSize = new System.Drawing.Size(8, 18);
this.ClientSize = new System.Drawing.Size(586, 345);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.label9);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.dateTimePicker1);
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "ModifyClass";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "修改班级信息";
this.Load += new System.EventHandler(this.ModifyClass_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void ModifyClass_Load(object sender, System.EventArgs e)
{
string sql="select SpecialtyId,SpecialtyName from SpecialtyInfo";
OleDbDataAdapter adp=new OleDbDataAdapter(sql,oleDbConnection1);
DataSet ds=new DataSet();
adp.Fill(ds,"Specialty");
comboBox1.DataSource=ds.Tables["Specialty"].DefaultView;
comboBox1.DisplayMember="SpecialtyName";
comboBox1.ValueMember="SpecialtyId";
comboBox1.Text=label9.Text.Trim();
}
private void button1_Click(object sender, System.EventArgs e)
{
if (textBox1.Text.Trim()=="" || comboBox1.Text.Trim()=="" || textBox3.Text.Trim()=="" || textBox5.Text.Trim()=="")
MessageBox.Show("请输入完整的班级信息","提示");
else
{
oleDbConnection1.Open();
string pd="select * from ClassInfo where ClassName='"+textBox1.Text.Trim()+"' and ClassId<>"+this.Tag.ToString().Trim();
OleDbCommand cmd=new OleDbCommand(pd,oleDbConnection1);
if (null!=cmd.ExecuteScalar())
MessageBox.Show("班级名称发生重复","提示");
else
{
string sql;
sql="update ClassInfo set ClassName='"+textBox1.Text.ToString()+"',SpecialtyName='"+comboBox1.Text.ToString()+"',ClassNumber='"+textBox3.Text.ToString()+"',Length="+numericUpDown1.Value.ToString()+",Teacher='"+textBox5.Text.ToString()+"',Enrolmenttime='"+dateTimePicker1.Text+"'";
if (textBox2.Text!="")
sql=sql+",Remark='"+textBox2.Text.ToString()+"'";
sql=sql+" where ClassId="+this.Tag.ToString().Trim();
cmd.CommandText=sql;
cmd.ExecuteNonQuery();
MessageBox.Show("班级信息修改成功","提示");
}
oleDbConnection1.Close();
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -