Пример #1
0
 private void btnXoaHocSinh_Click(object sender, EventArgs e)
 {
     if (lvdshs.SelectedItems.Count > 0)
     {
         DShocsinhBLL dshsbll = new DShocsinhBLL();
         bool         result  = dshsbll.XoaHs(lvdshs.SelectedItems[0].SubItems[1].Text);
         if (!result)
         {
             MessageBox.Show(" Không thể xóa,Vui lòng kiểm tra lại kết nối CSDL!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show(" Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Bạn phải chọn 1 học sinh để xóa !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void btnXoaHocSinh_Click_1(object sender, EventArgs e)
 {
     if (lvdshs.SelectedItems.Count > 0)
     {
         string       maHocSinh  = lvdshs.SelectedItems[0].SubItems[1].Text;
         DShocsinhBLL hocsinhbll = new DShocsinhBLL();
         if (hocsinhbll.XoaHs(maHocSinh))
         {
             MessageBox.Show("Xóa thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LoadDSHS_DSHS();
         }
         else
         {
             MessageBox.Show("Xóa thất bại, thử kiểm tra lại kết nối CSDL!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Bạn phải chọn ít nhất 1 dòng để xóa!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }