private void bt_select_Click(object sender, EventArgs e) { string courseName = null; string courseType = isNull(cb_courseType.Text); string courseTea = isNull(cb_classTeacher.SelectedValue.ToString()); DataSet ds = DAO_T_C.selectT_CData(courseName, courseType, courseTea); DataTable dataTable = ds.Tables["t_c_View"]; dataGridView1.DataSource = dataTable; }
//设置授课情况表格数据 private void setTea_CourData() { string courseName = null; string courTea = null; string courseType = null; DataSet dataSet = DAO_T_C.selectT_CData(courseName, courseType, courTea); DataTable dataTable = dataSet.Tables["t_c_View"]; dataGridView1.DataSource = dataTable; }
public UpdateTeaCourse(string courseName) { InitializeComponent(); setTeaData(); this.courseName = courseName; DataSet dataSet = DAO_T_C.selectT_CData(courseName, courseType, courTea); DataTable dataTable = dataSet.Tables["t_c_View"]; courTea = dataTable.Rows[0][2].ToString(); tb_courseName.Text = courseName; cb_courseTea.Text = courTea; }
private void add_button_Click(object sender, EventArgs e) { string CourseTeacher = cb_classTeacher.Text; string CourseName = tb_className.Text; string CourseType = cb_classType.Text; string CourseTime = tb_CourseTime.Text; bool result = DAO_T_C.AddClass(CourseName, CourseType, CourseTeacher, CourseTime); if (result) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败"); } }
private void change_button_Click(object sender, EventArgs e) { string courseTea_New = cb_courseTea.Text; string courseName_New = tb_courseName.Text; string courseType = ""; string NewcourseType = ""; string NewcourseTime = ""; bool result = DAO_T_C.updateT_C(courseName, courTea, courseName_New, courseTea_New); //调用方法修改授课表 bool result_1 = DAO_Course.updateCourse(courseName, courseType, courseName_New, NewcourseType, NewcourseTime); if (result && result_1) { MessageBox.Show("修改成功"); } //判断是否修改成功 else { MessageBox.Show("修改失败,请重试"); }; }