private void button7_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = " select g.开课编号hjh,e.开课学期hjh,h.课程名称hjh,i.姓名hjh '授课教师hjh',h.学分hjh,g.教学评定hjh " + " from 学生hjh b,班级hjh c,开设hjh e,开课hjh f,选修hjh g,课程hjh h,教师hjh i " + " where b.学生编号hjh = '" + this.num + "' " + " and b.班级编号hjh = c.班级编号hjh and c.专业编号hjh = e.专业编号hjh " + " and e.课程编号hjh = f.课程编号hjh and b.班级编号hjh = f.班级编号hjh " + " and g.开课编号hjh = f.开课编号hjh and g.学生编号hjh = b.学生编号hjh " + " and f.课程编号hjh = h.课程编号hjh and f.教师编号hjh = i.教师编号hjh "; if (comboBox6.Text.ToString().Trim() != "*") { sql += " and e.开课学期hjh = '" + comboBox6.Text.ToString().Trim() + "' "; } try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button16_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage5) { return; } if (textBox9.Text == "") { MessageBox.Show("请输入开课号!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select * from 开课hjh where 开课编号hjh = '" + textBox9.Text + "'"; try { InfoType = "开课"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { textBox9.Text = ""; cc.closeConnect(); } }
private void button14_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage4) { return; } sqlConnect cc = new sqlConnect(); string sql = "select b.专业名称hjh,c.课程名称hjh,a.开课学期hjh from 开设hjh a,专业hjh b ,课程hjh c " + " where a.专业编号hjh = b.专业编号hjh and a.课程编号hjh = c.课程编号hjh "; if (textBox7.Text != "*") { sql += " and b.专业名称hjh = '" + textBox7.Text + "'"; } if (comboBox6.Text != "*") { sql += " and a.开课学期hjh = '" + comboBox6.Text + "' "; } sql += " order by a.开课学期hjh "; try { InfoType = "专业培养计划"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button15_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage4) { return; } if (textBox8.Text == "") { MessageBox.Show("请输入专业编号!"); return; } sqlConnect cc = new sqlConnect(); string sql = " select b.专业名称hjh,c.课程名称hjh,a.开课学期hjh from 开设hjh a,专业hjh b ,课程hjh c " + " where a.专业编号hjh = b.专业编号hjh and a.课程编号hjh = c.课程编号hjh and a.专业编号hjh = '" + textBox8.Text + "'" + " order by a.开课学期hjh "; try { InfoType = "专业培养计划"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button3_Click(object sender, EventArgs e) { string sql = "select c.开课编号hjh,d.课程名称hjh,AVG(c.成绩hjh) '课程平均分hjh' " + " from 学生hjh a,开课hjh b,选修hjh c,课程hjh d " + " where a.班级编号hjh = b.班级编号hjh " + " and a.学生编号hjh = '" + this.num + "' " + " and c.开课编号hjh = b.开课编号hjh " + " and b.课程编号hjh = d.课程编号hjh " + " group by d.课程名称hjh ,c.开课编号hjh "; sqlConnect cc = new sqlConnect(); try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button11_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage3) { return; } if (textBox6.Text == "") { MessageBox.Show("请输入课程号!"); return; } if (textBox6.Text.Length != 6) { textBox6.Text = ""; MessageBox.Show("对不起,请输入6位数字!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select * from 课程hjh where 课程编号hjh = '" + textBox6.Text + "'"; try { InfoType = "courses"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { textBox6.Text = ""; cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = "select a.开课编号hjh,d.课程名称hjh,c.专业名称hjh,b.班级序号hjh,d.学分hjh,d.考核方式hjh,e.开课学期hjh,a.评定等级hjh " + " from 开课hjh a ,班级hjh b,专业hjh c,课程hjh d ,开设hjh e " + " where a.教师编号hjh = '" + this.num + "' and a.班级编号hjh = b.班级编号hjh and b.专业编号hjh = c.专业编号hjh " + " and a.课程编号hjh = d.课程编号hjh and e.课程编号hjh = a.课程编号hjh and e.专业编号hjh = b.专业编号hjh "; if (comboBox1.Text != "*") { sql += " and e.开课学期hjh = '" + comboBox1.Text + "'"; } try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; dataGridView1.Columns[6].ReadOnly = true; dataGridView1.Columns[7].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button24_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); if (comboBox10.SelectedValue == null || comboBox10.DisplayMember == null) { MessageBox.Show("请选择一个班级!"); return; } string sql = "select a.开课编号hjh ,b.姓名hjh,e.课程名称hjh ,f.专业名称hjh,c.班级序号hjh " + " from 选修hjh a ,学生hjh b,班级hjh c,开课hjh d,课程hjh e,专业hjh f " + " where a.学生编号hjh = b.学生编号hjh and b.班级编号hjh = c.班级编号hjh " + " and a.开课编号hjh = d.开课编号hjh and d.课程编号hjh = e.课程编号hjh " + " and c.专业编号hjh = f.专业编号hjh " + " and b.班级编号hjh = '" + comboBox10.SelectedValue.ToString().Trim() + "' " + " order by b.姓名hjh "; try { InfoType = "课程同步"; dataGridView1.Columns.Clear(); cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请输入学号!"); return; } if (textBox1.Text.Length != 6) { textBox1.Text = ""; MessageBox.Show("对不起,请输入6位数字!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select * from 学生hjh where 学生编号hjh = '" + textBox1.Text + "'"; try { cc.BindDataGridView(dgv, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button3_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage1) { return; } sqlConnect cc = new sqlConnect(); string sql = "select * " + " from 学生视图hjh "; bool flag = false; if (comboBox1.Text != "*") { flag = true; sql += "where 学院名称hjh = '" + comboBox1.Text + "'"; } if (textBox2.Text != "*") { if (!flag) { sql += " where "; } else { sql += " and "; } sql += " 专业名称hjh = '" + textBox2.Text + "'"; flag = true; } if (textBox3.Text != "*") { if (!flag) { sql += " where "; } else { sql += " and "; } sql += " 班级序号hjh = " + textBox3.Text; } try { InfoType = "students"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void TeacherQueryPost_Load(object sender, EventArgs e) { this.Text += "(教师:" + this.num + ")"; label2.Text = this.num; /* * * select a.开课编号hjh,d.课程名称hjh,c.专业名称hjh,b.班级序号hjh,d.学分hjh,d.考核方式hjh,e.开课学期hjh,a.评定等级hjh * from 开课hjh a ,班级hjh b,专业hjh c,课程hjh d ,开设hjh e * where a.教师编号hjh = '010101' and a.班级编号hjh = b.班级编号hjh and b.专业编号hjh = c.专业编号hjh * and a.课程编号hjh = d.课程编号hjh and e.课程编号hjh = a.课程编号hjh and e.专业编号hjh = b.专业编号hjh * * * * */ sqlConnect cc = new sqlConnect(); string sql = "select a.开课编号hjh,d.课程名称hjh,c.专业名称hjh,b.班级序号hjh,d.学分hjh,d.考核方式hjh,e.开课学期hjh,a.评定等级hjh " + " from 开课hjh a ,班级hjh b,专业hjh c,课程hjh d ,开设hjh e " + " where a.教师编号hjh = '" + this.num + "' and a.班级编号hjh = b.班级编号hjh and b.专业编号hjh = c.专业编号hjh " + " and a.课程编号hjh = d.课程编号hjh and e.课程编号hjh = a.课程编号hjh and e.专业编号hjh = b.专业编号hjh "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; dataGridView1.Columns[6].ReadOnly = true; dataGridView1.Columns[7].ReadOnly = true; string sql2 = "select * from 学院hjh"; SqlDataAdapter da = new SqlDataAdapter(sql2, cc.conn); DataSet ds2 = new DataSet(); da.Fill(ds2, "学院hjh"); comboBox2.DisplayMember = "学院hjh.学院名称hjh"; comboBox2.DataSource = ds2; comboBox2.ValueMember = "学院hjh.学院编号hjh"; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.Text == "" || comboBox2.Text == "") { MessageBox.Show("请选择一个班级!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select a.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 开课hjh a,选修hjh b,学生hjh c" + " where a.开课编号hjh = b.开课编号hjh and b.学生编号hjh = c.学生编号hjh " + " and a.班级编号hjh='" + comboBox2.SelectedValue.ToString().Trim() + "' and a.课程编号hjh ='" + comboBox1.SelectedValue.ToString().Trim() + "' and a.教师编号hjh ='" + this.num + "' "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; double total = 0; int stuNum = dataGridView1.RowCount - 1; int unPassed = 0; for (int i = 0; i < stuNum; i++) { int tmp = int.Parse(dataGridView1.Rows[i].Cells["成绩hjh"].Value.ToString()); if (tmp < 60) { unPassed++; } total += (double)tmp; } total /= stuNum; label8.Text = total.ToString(); label9.Text = stuNum.ToString(); label10.Text = unPassed.ToString(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void ProfDevelopPlan_Load(object sender, EventArgs e) { label4.Text = this.num; string sql = " select a.姓名hjh,c.专业名称hjh,b.班级序号hjh,a.已修学分hjh,a.平均绩点hjh,c.毕业最少学分hjh " + " from 学生hjh a, 班级hjh b,专业hjh c " + " where a.学生编号hjh = '" + this.num + "' and a.班级编号hjh = b.班级编号hjh " + " and b.专业编号hjh = c.专业编号hjh "; string sql2 = " select h.课程名称hjh,h.学分hjh,h.学时hjh,h.考核方式hjh,e.开课学期hjh,h.课程介绍hjh,g.成绩hjh,g.教学评定hjh " + " from 学生hjh b,班级hjh c,开设hjh e,课程hjh h,选修hjh g,开课hjh k " + " where b.学生编号hjh = '" + this.num + "' " + " and b.班级编号hjh = c.班级编号hjh " + " and c.专业编号hjh = e.专业编号hjh " + " and e.课程编号hjh = h.课程编号hjh " + " and g.学生编号hjh = b.学生编号hjh " + " and k.班级编号hjh = c.班级编号hjh " + " and k.课程编号hjh = h.课程编号hjh " + " and k.开课编号hjh = g.开课编号hjh " + " order by e.开课学期hjh "; sqlConnect cc = new sqlConnect(); try { DataSet ds = cc.GetDataSet(sql); label6.Text = ds.Tables[0].Rows[0]["姓名hjh"].ToString().Trim(); label5.Text = ds.Tables[0].Rows[0]["专业名称hjh"].ToString().Trim() + "0" + ds.Tables[0].Rows[0]["班级序号hjh"].ToString().Trim(); label23.Text = ds.Tables[0].Rows[0]["已修学分hjh"].ToString().Trim(); label24.Text = ds.Tables[0].Rows[0]["平均绩点hjh"].ToString().Trim(); label7.Text = "(毕业最少学分: " + ds.Tables[0].Rows[0]["毕业最少学分hjh"].ToString().Trim() + ")"; this.Text = ds.Tables[0].Rows[0]["专业名称hjh"].ToString().Trim() + "专业(学生:" + this.num + ")"; cc.BindDataGridView(dataGridView1, sql2); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; dataGridView1.Columns[6].ReadOnly = true; dataGridView1.Columns[7].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button20_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage6) { return; } if (textBox10.Text == "") { MessageBox.Show("请输入学号!"); return; } if (textBox10.Text.Length != 12) { textBox10.Text = ""; MessageBox.Show("对不起,请输入12位数字!"); return; } sqlConnect cc = new sqlConnect(); /* * * select a.学生编号hjh,d.姓名hjh '学生姓名hjh',e.课程名称hjh,c.姓名hjh '授课教师hjh',e.学分hjh,a.成绩hjh * from 选修hjh a,开课hjh b ,教师hjh c ,学生hjh d,课程hjh e * where a.学生编号hjh = '200901010101' and a.开课编号hjh = b.开课编号hjh * and b.教师编号hjh = c.教师编号hjh and a.学生编号hjh = d.学生编号hjh * and b.课程编号hjh = e.课程编号hjh * * * */ string sql = "select a.学生编号hjh,d.姓名hjh '学生姓名hjh',e.课程名称hjh,c.姓名hjh '授课教师hjh',e.学分hjh,a.成绩hjh " + " from 选修hjh a,开课hjh b ,教师hjh c ,学生hjh d,课程hjh e " + " where a.学生编号hjh = '" + textBox10.Text + "' and a.开课编号hjh = b.开课编号hjh " + " and b.教师编号hjh = c.教师编号hjh and a.学生编号hjh = d.学生编号hjh " + " and b.课程编号hjh = e.课程编号hjh"; try { InfoType = "成绩管理"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { textBox10.Text = ""; cc.closeConnect(); } }
private void button10_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage3) { return; } sqlConnect cc = new sqlConnect(); /* * * select a.课程编号hjh,a.课程名称hjh,b.学院名称hjh ,a.考核方式hjh,a.学时hjh,a.学分hjh,a.课程介绍hjh * from 课程hjh a ,学院hjh b * where a.学院编号hjh = b.学院编号hjh * * */ string sql = "select a.课程编号hjh,a.课程名称hjh,b.学院名称hjh ,a.考核方式hjh,a.学时hjh,a.学分hjh,a.课程介绍hjh " + " from 课程hjh a ,学院hjh b " + " where a.学院编号hjh = b.学院编号hjh "; if (comboBox5.Text != "*") { sql += " and b.学院名称hjh = '" + comboBox5.Text + "'"; } if (textBox5.Text != "*") { sql += " and a.课程名称hjh = '" + textBox5.Text + "'"; } try { InfoType = "courses"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button6_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage2) { return; } sqlConnect cc = new sqlConnect(); /* * select a.教师编号hjh ,a.姓名hjh,a.性别hjh,b.学院名称hjh,a.出生年月hjh,a.学历hjh,a.职称hjh,a.电子邮箱hjh,a.联系电话hjh,a.权限级别hjh * from 教师hjh a ,学院hjh b * where a.学院编号hjh = b.学院编号hjh */ string sql = "select a.教师编号hjh ,a.姓名hjh,a.性别hjh,b.学院名称hjh,a.出生年月hjh,a.学历hjh,a.职称hjh,a.电子邮箱hjh,a.联系电话hjh,a.权限级别hjh " + " from 教师hjh a, 学院hjh b where a.学院编号hjh = b.学院编号hjh "; if (comboBox2.Text != "*") { sql += " and b.学院名称hjh = '" + comboBox2.Text + "'"; } if (comboBox3.Text != "*") { sql += " and a.职称hjh = '" + comboBox3.Text + "'"; } if (comboBox4.Text != "*") { sql += " and a.学历hjh = '" + comboBox4.Text + "'"; } try { InfoType = "teachers"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button5_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = "select d.开课编号hjh,e.课程名称hjh,f.姓名hjh '授课教师hjh',e.学分hjh,e.考核方式hjh,d.上课时间地点hjh,c.开课学期hjh " + " from 学生hjh a, 班级hjh b,开设hjh c,开课hjh d,课程hjh e ,教师hjh f " + " where a.学生编号hjh ='" + this.num + "' " + " and a.班级编号hjh = b.班级编号hjh " + " and b.专业编号hjh = c.专业编号hjh " + " and c.课程编号hjh = e.课程编号hjh " + " and c.课程编号hjh = d.课程编号hjh " + " and d.班级编号hjh = b.班级编号hjh " + " and d.课程编号hjh = e.课程编号hjh " + " and d.教师编号hjh = f.教师编号hjh "; if (comboBox3.Text.ToString().Trim() != "*") { sql += " and c.开课学期hjh = '" + comboBox3.Text.ToString().Trim() + "' "; } else { sql += " order by c.开课学期hjh "; } try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button3_Click(object sender, EventArgs e) { if (comboBox2.Text == "" || comboBox4.Text == "") { MessageBox.Show("请选择一个班级!"); return; } sqlConnect cc = new sqlConnect(); /* * * select a.开课编号hjh,c.姓名hjh,b.成绩hjh * from 开课hjh a,选修hjh b,学生hjh c * where a.开课编号hjh = b.开课编号hjh and b.学生编号hjh = c.学生编号hjh * and a.班级编号hjh='' and a.课程编号hjh ='' and a.教师编号hjh ='' * * */ string sql = "select a.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 开课hjh a,选修hjh b,学生hjh c" + " where a.开课编号hjh = b.开课编号hjh and b.学生编号hjh = c.学生编号hjh " + " and a.班级编号hjh='" + comboBox4.SelectedValue.ToString().Trim() + "' and a.课程编号hjh ='" + comboBox2.SelectedValue.ToString().Trim() + "' and a.教师编号hjh ='" + this.num + "' "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button7_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage2) { return; } if (textBox4.Text == "") { MessageBox.Show("请输入教工号!"); return; } if (textBox4.Text.Length != 6) { textBox4.Text = ""; MessageBox.Show("对不起,请输入6位数字!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select a.教师编号hjh ,a.姓名hjh,a.性别hjh,b.学院名称hjh," + " a.出生年月hjh,a.学历hjh,a.职称hjh,a.电子邮箱hjh,a.联系电话hjh,a.权限级别hjh " + " from 教师hjh a ,学院hjh b where a.学院编号hjh = b.学院编号hjh " + " and a.教师编号hjh = '" + textBox4.Text + "'"; try { InfoType = "teachers"; cc.BindDataGridView(dataGridView1, sql); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { textBox4.Text = ""; cc.closeConnect(); } }
private void button18_Click(object sender, EventArgs e) { if (管理.SelectedTab != tabPage5) { return; } MessageBox.Show(comboBox9.SelectedValue.ToString() + " " + comboBox9.Text); sqlConnect cc = new sqlConnect(); if (comboBox7.Text == "" || comboBox8.Text == "" || comboBox9.Text == "") { MessageBox.Show("请指定一个班级!"); return; } string sql = "select a.开课编号hjh ,d.课程名称hjh,b.姓名hjh '授课教师hjh',f.学院名称hjh,e.专业名称hjh,c.班级序号hjh,a.上课时间地点hjh,a.评定等级hjh " + " from 开课hjh a, 教师hjh b,班级hjh c,课程hjh d ,专业hjh e,学院hjh f " + " where a.教师编号hjh = b.教师编号hjh " + " and a.班级编号hjh = c.班级编号hjh and a.课程编号hjh = d.课程编号hjh " + " and c.专业编号hjh = e.专业编号hjh and e.学院编号hjh = f.学院编号hjh " + " and a.班级编号hjh = '" + comboBox9.SelectedValue.ToString() + "'"; try { InfoType = "开课"; cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button4_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("请输入开课编号!"); return; } sqlConnect cc = new sqlConnect(); string sql2 = "select * from 开课hjh where 开课编号hjh = '" + textBox1.Text + "' and 教师编号hjh = '" + this.num + "'"; DataSet ds = cc.GetDataSet(sql2); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("对不起,该课程不存在或不是您的课!"); return; } string sql = "select b.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 选修hjh b,学生hjh c" + " where b.开课编号hjh = '" + textBox1.Text + "'and b.学生编号hjh = c.学生编号hjh "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void TeacherUnPassedTable_Load(object sender, EventArgs e) { this.Text += "(教师:" + this.num + ")"; if (this.aN == "" || this.bN == "") { MessageBox.Show("请选择一个班级!"); return; } sqlConnect cc = new sqlConnect(); string sql = "select a.开课编号hjh,c.学生编号hjh,c.姓名hjh,b.成绩hjh " + " from 开课hjh a,选修hjh b,学生hjh c" + " where a.开课编号hjh = b.开课编号hjh and b.学生编号hjh = c.学生编号hjh " + " and b.成绩hjh<60 " + " and a.班级编号hjh='" + this.aN + "' and a.课程编号hjh ='" + this.bN + "' and a.教师编号hjh ='" + this.num + "' "; try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }
private void button1_Click(object sender, EventArgs e) { sqlConnect cc = new sqlConnect(); string sql = " select h.课程名称hjh,i.姓名hjh '授课教师hjh',h.学分hjh,h.考核方式hjh,e.开课学期hjh,g.成绩hjh " + " from 学生hjh b,班级hjh c,开设hjh e,开课hjh f,选修hjh g,课程hjh h,教师hjh i " + " where b.学生编号hjh = '" + this.num + "' " + " and b.班级编号hjh = c.班级编号hjh and c.专业编号hjh = e.专业编号hjh " + " and e.课程编号hjh = f.课程编号hjh and b.班级编号hjh = f.班级编号hjh " + " and g.开课编号hjh = f.开课编号hjh and g.学生编号hjh = b.学生编号hjh " + " and f.课程编号hjh = h.课程编号hjh and f.教师编号hjh = i.教师编号hjh "; if (checkBox1.Checked) { sql += " and g.成绩hjh >=0 "; } if (comboBox1.Text.ToString().Trim() != "*") { sql += " and e.开课学期hjh = '" + comboBox1.Text.ToString().Trim() + "' "; } try { cc.BindDataGridView(dataGridView1, sql); dataGridView1.Columns[0].ReadOnly = true; dataGridView1.Columns[1].ReadOnly = true; dataGridView1.Columns[2].ReadOnly = true; dataGridView1.Columns[3].ReadOnly = true; dataGridView1.Columns[4].ReadOnly = true; dataGridView1.Columns[5].ReadOnly = true; double total = 0; int CourseNum = 0; int totalCredit = 0; int excellent = 0; int unPassed = 0; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { int tmp = int.Parse(dataGridView1.Rows[i].Cells["成绩hjh"].Value.ToString()); if (tmp <= 0) { continue; } int credit = int.Parse(dataGridView1.Rows[i].Cells["学分hjh"].Value.ToString()); CourseNum++; if (tmp < 60) { unPassed++; } if (tmp >= 95) { excellent++; } total += (double)(tmp - 50) * credit; totalCredit += credit; } total = total / (totalCredit * 10); StudentGradeResult frm = new StudentGradeResult(this.num, total, unPassed, excellent, comboBox1.Text.ToString().Trim(), "学期"); frm.ShowDialog(); frm.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { cc.closeConnect(); } }