private void btnLuu_Click(object sender, EventArgs e) { try { if (txtLoaiThuoc.Text.Trim() != "") { if (f) { bool trangthai = lt.ThemLoaiThuoc(txtLoaiThuoc.Text); if (trangthai) { MessageBox.Show("Thêm dữ liệu thành công!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show("Không thêm được dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { string err = ""; bool trangthai = lt.SuaLoaiThuoc(currentMaLoaiThuoc, txtLoaiThuoc.Text); if (trangthai) { MessageBox.Show("Sữa thành công!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show("Không sữa được dữ liệu !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Hãy nhập dữ liệu vào ô!", "Thông báo"); } } catch (SqlException) { } }