private void ad_bcup_Click(object sender, EventArgs e) { tbl.tblCourse c = new tbl.tblCourse(txtCourseID.Text, txtCoursename.Text); if (course.UpdateCourse(c) == false) { MessageBox.Show("Can not update this course !!!", "Error"); } else { MessageBox.Show("Successfully Updated!!!"); } ad_dgv_c.DataSource = course.getAllCourses(); ad_dgv_c.Show(); }
private void ad_cc_Click(object sender, EventArgs e) { if (Check_Fill()) { tbl.tblCourse c = new tbl.tblCourse(txtCourseID.Text, txtCoursename.Text); if (course.InsertCourse(c) == false) { MessageBox.Show("Can not insert this course !!!", "Error"); } else { MessageBox.Show("Successfully Inserted!!!"); } ad_dgv_c.DataSource = course.getAllCourses(); ad_dgv_c.Show(); Binding(); } }
public bool DeleteCourse(tbl.tblCourse c) { string sql = "DELETE COURSES WHERE COURSE_ID = @COURSE_ID COLLATE SQL_Latin1_General_CP1_CS_AS "; SqlConnection con = dc.getConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@COURSE_ID", SqlDbType.VarChar).Value = c.COURSE_ID; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool InsertCourse(tbl.tblCourse c) { string sql = "INSERT INTO COURSES VALUES(@COURSE_ID,@COURSENAME)"; SqlConnection con = dc.getConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@COURSE_ID", SqlDbType.VarChar).Value = c.COURSE_ID; cmd.Parameters.Add("@COURSENAME", SqlDbType.NVarChar).Value = c.COURSENAME; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool DeleteCourse(tbl.tblCourse c) { return(dalC.DeleteCourse(c)); }
public bool UpdateCourse(tbl.tblCourse c) { return(dalC.UpdateCourse(c)); }
public bool InsertCourse(tbl.tblCourse c) { return(dalC.InsertCourse(c)); }