Exemplo n.º 1
0
 private void bt_luu_Click(object sender, EventArgs e)//luu
 {
     if (isThem == true)
     {
         try
         {
             NhomTacGia ntg = new NhomTacGia();
             ntg.ThemNhom(this.tb_mn.Text, this.tb_tn.Text, ref error);
             Loaddata();
             MessageBox.Show("Đã thêm");
         }
         catch (SqlException)
         {
             MessageBox.Show("Lỗi thêm");
         }
     }
     else
     {
         try
         {
             NhomTacGia ntg = new NhomTacGia();
             ntg.CapNhatNhom(this.tb_mn.Text, this.tb_tn.Text, ref error);
             Loaddata();
             MessageBox.Show("Đã sửa xong!");
         }
         catch (SqlException)
         {
             MessageBox.Show("Lỗi khi sửa");
         }
     }
 }
Exemplo n.º 2
0
 private void bt_capnhat_Click(object sender, EventArgs e)//cap nhat
 {
     try
     {
         NhomTacGia mn = new NhomTacGia();
         mn.CapNhatNhom(this.tb_mn.Text, this.tb_tn.Text, ref error);
         Loaddata();
         MessageBox.Show("Đã nhập nhật!");
     }
     catch (SqlException)
     {
         MessageBox.Show("Xảy ra lỗi trong khi cập nhập!");
     }
 }
Exemplo n.º 3
0
 private void bt_xoa_Click(object sender, EventArgs e)//xoa
 {
     try
     {
         NhomTacGia mn = new NhomTacGia();
         mn.XoaNhom(this.tb_mn.Text, ref error);
         Loaddata();
         MessageBox.Show("Đã xóa xong!");
     }
     catch (SqlException)
     {
         MessageBox.Show("Xảy ra lỗi trong khi xóa!");
     }
 }