//Sửa Bảng Điểm public static int CapNhatDiem(Object_BangDiem bd) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@malhp", bd.MaLHP), new SqlParameter("@masv", bd.MaSV), new SqlParameter("@diem_01", bd.Diem_01), new SqlParameter("@diem_02", bd.Diem_02), new SqlParameter("@diem_07", bd.Diem_07) }; return(DataProvider.ExecuteNonQuery("suadiem", para)); }
private void btn_luu2_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có muốn cập nhật", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { Object_BangDiem bd = new Object_BangDiem(); DataGridViewRow row = dgr_bangdiem.CurrentRow; for (int i = 0; i < dgr_bangdiem.Rows.Count - 1; i++) { bd.MaLHP = txt_malhp.Text; // if(dgr_bangdiem.Rows[i].Cells["diem_01"].Value==null) if (dgr_bangdiem.Rows[i].Cells["masv"].Value.ToString().Length != 0) { bd.MaSV = dgr_bangdiem.Rows[i].Cells["masv"].Value.ToString(); } else { bd.MaSV = null; } if (dgr_bangdiem.Rows[i].Cells["diem_01"].Value.ToString() == "") { continue; //bd.Diem_01 = Convert.ToDouble(null); } else { bd.Diem_01 = Convert.ToDouble(dgr_bangdiem.Rows[i].Cells["diem_01"].Value); } if (dgr_bangdiem.Rows[i].Cells["diem_02"].Value.ToString() == "") {// bd.Diem_02 = Convert.ToDouble(null); continue; } else { bd.Diem_02 = Convert.ToDouble(dgr_bangdiem.Rows[i].Cells["diem_02"].Value); } if (dgr_bangdiem.Rows[i].Cells["diem_07"].Value.ToString() == "") {// bd.Diem_07 = Convert.ToDouble(null); continue; } else { bd.Diem_07 = Convert.ToDouble(dgr_bangdiem.Rows[i].Cells["diem_07"].Value); } int val = Bus.CapNhatDiem(bd); } MessageBox.Show("Cập nhật thành công!", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } }
//chỉnh sửa bảng điểm public static int CapNhatDiem(Object_BangDiem bd) { return(Dao.CapNhatDiem(bd)); }