private void bt_luu_Click(object sender, EventArgs e) { if (isThem == true) { try { TheLoaiNghienCuu tl = new TheLoaiNghienCuu(); tl.ThemTheLoai(this.tb_mtl.Text, this.tb_ttl.Text, ref error); Loaddata(); MessageBox.Show("Đã thêm"); } catch (SqlException) { MessageBox.Show("Lỗi thêm"); } } else { try { TheLoaiNghienCuu tl = new TheLoaiNghienCuu(); tl.CapNhatTheLoai(this.tb_mtl.Text, this.tb_ttl.Text, ref error); Loaddata(); MessageBox.Show("Đã sửa xong!"); } catch (SqlException) { MessageBox.Show("Lỗi khi sửa"); } } }
private void bt_capnhat_Click(object sender, EventArgs e) { try { TheLoaiNghienCuu tl = new TheLoaiNghienCuu(); tl.CapNhatTheLoai(this.tb_mtl.Text, this.tb_ttl.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!"); } }
private void button3_Click(object sender, EventArgs e) { try { TheLoaiNghienCuu tl = new TheLoaiNghienCuu(); tl.XoaTheLoai(this.tb_mtl.Text, ref error); Loaddata(); MessageBox.Show("Đã xóa xong!"); } catch (SqlException) { MessageBox.Show("Xảy ra lỗi trong khi xóa!"); } }