📄 f93计1.cs
字号:
this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
//
// menuItem21
//
this.menuItem21.Index = 3;
this.menuItem21.Text = "综合表";
this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
//
// menuItem22
//
this.menuItem22.Index = 5;
this.menuItem22.Text = "帮助";
this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
//
// menuItem23
//
this.menuItem23.Index = 6;
this.menuItem23.Text = "版本信息";
this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
//
// menuItem24
//
this.menuItem24.Index = 7;
this.menuItem24.Text = "退出";
this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(128, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 56);
this.button1.TabIndex = 0;
this.button1.Text = "教师平均年龄";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(416, 64);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 56);
this.button2.TabIndex = 1;
this.button2.Text = "学生平均年龄";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(112, 136);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(136, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(408, 136);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(136, 21);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "";
//
// Form12
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(742, 473);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox2,
this.textBox1,
this.button2,
this.button1});
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.Name = "Form12";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "计算平均年龄";
this.ResumeLayout(false);
}
#endregion
private void menuItem24_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void menuItem23_Click(object sender, System.EventArgs e)
{
MessageBox.Show(" 数据库课程设计\r -------教学管理系统\r\r小组成员:金铎,汪欣,齐肖西,李莎,王丽芳");
}
private void menuItem22_Click(object sender, System.EventArgs e)
{
MessageBox.Show("暂无帮助信息!");
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form2=new Form2();
form2.ShowDialog ();
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form3=new Form3();
form3.ShowDialog ();
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form4=new Form4();
form4.ShowDialog ();
}
private void menuItem6_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form5=new Form5();
form5.ShowDialog ();
}
private void menuItem7_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form6=new Form6();
form6.ShowDialog ();
}
private void menuItem8_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form7=new Form7();
form7.ShowDialog ();
}
private void menuItem10_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form8=new Form8();
form8.ShowDialog ();
}
private void menuItem11_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form9=new Form9();
form9.ShowDialog ();
}
private void menuItem12_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form10=new Form10();
form10.ShowDialog ();
}
private void menuItem13_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form11=new Form11();
form11.ShowDialog ();
}
private void menuItem15_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form12=new Form12();
form12.ShowDialog ();
}
private void menuItem16_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form13=new Form13();
form13.ShowDialog ();
}
private void menuItem18_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form14=new Form14();
form14.ShowDialog ();
}
private void menuItem19_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form15=new Form15();
form15.ShowDialog ();
}
private void menuItem20_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form16=new Form16();
form16.ShowDialog ();
}
private void menuItem21_Click(object sender, System.EventArgs e)
{
this.Hide();
Form form17=new Form17();
form17.ShowDialog ();
}
private void button1_Click(object sender, System.EventArgs e)
{
int s_age;
s_age=0;
SqlConnection connection = new SqlConnection("workstation id=S0353;packet size=4096;integrated security=SSPI;data source=S0353;pe" +
"rsist security info=False;initial catalog=TSC");
try
{
connection.Open();
SqlCommand command = new SqlCommand("select avg(Tage) from T ",connection);
SqlDataReader data= command.ExecuteReader();
MessageBox.Show("计算完毕");
while (data.Read())
{
s_age= (int)data[0];
}
MessageBox.Show("\t平均年龄为: " + s_age);
textBox1.Text=s_age.ToString(); ;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
int s_age;
s_age=0;
SqlConnection connection = new SqlConnection("workstation id=S0353;packet size=4096;integrated security=SSPI;data source=S0353;pe" +
"rsist security info=False;initial catalog=TSC");
try
{
connection.Open();
SqlCommand command = new SqlCommand("select avg(Sage) from S ",connection);
SqlDataReader data= command.ExecuteReader();
MessageBox.Show("计算完毕");
while (data.Read())
{
s_age= (int)data[0];
}
MessageBox.Show("\t平均年龄为: " + s_age);
textBox2.Text=s_age.ToString(); ;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -