Update
How do I use Update
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ClassBLL.cs
Copy
307 public void Update(string table, string sql)
308 {
309 sql = "update "+table+" set "+sql+"";
310 da.ExcuteNonQuery(sql);
311 }
File name: FormGiangVien.cs
Copy
69 private void btnSua_Click(object sender, EventArgs e)
70 {
71 string sql = "TenGV='"+txtTenGV.Text+"',NgaySinh='"+dtpNamSinh.Text+"',DiaChi='"+txtDiaChi.Text+"' where MaGV='"+txtMaGV.Text+"'";
72 business.Update("GiangVien",sql);
73 FormGiangVien_Load(sender,e);
74 }
File name: FormHeDaoTao.cs
Copy
66 private void btnSua_Click(object sender, EventArgs e)
67 {
68 string sql = "TenHeDT ='"+txtTenHeDT.Text+"' where MaHeDT='"+txtMaHeDT.Text+"'";
69 business.Update("HeDaoTao",sql);
70 FormHeDaoTao_Load(sender,e);
71 }
File name: FormHocKy.cs
Copy
69 private void btnSua_Click(object sender, EventArgs e)
70 {
71 string sql = "TenHK='" + txtTenHocKy.Text + "',NamHoc='" + txtNamHoc.Text + "',TGBatDau='" + dtpBatDau.Text + "',TGKetThuc='" + dtpKetThuc.Text + "' where MaHK='"+txtMaHocKy.Text+"'";
72 business.Update("HocKy",sql);
73 FormHocKy_Load(sender,e);
74 }
File name: FormHocPhan.cs
Copy
53 private void btnSua_Click(object sender, EventArgs e)
54 {
55 string sql = "TenHP='" + txtTenHP.Text + "',SoTC=" + Convert.ToInt32(txtSoTC.Text) + ",SoTietTH=" + Convert.ToInt32(txtSoTietTH.Text) + ",SoTietLT=" + Convert.ToInt32(txtSoTietLT.Text) + ",PhanTramDQT=" + Convert.ToInt32(txtPhanTramDQT.Text) + ",PhanTramDT=" + Convert.ToInt32(txtPhanTramDT.Text) + " where MaHP='"+txtMaHP.Text+"'";
56 business.Update("HocPhan", sql);
57 FormHocPhan_Load(sender, e);
58 }
File name: FormKHGD.cs
Copy
63 private void btnSua_Click(object sender, EventArgs e)
64 {
65 string sql = "MaHK='"+cmbMahocKy.SelectedValue.ToString()+"',MaKhoiLop='"+cmbMaKhoiLop.SelectedValue.ToString()+"' where MaKHGD='"+txtMaKHGD.Text+"'";
66 business.Update("KeHoachGiangDay",sql);
67 FormKHGD_Load(sender, e);
68 }
File name: FormKhoiLop.cs
Copy
72 private void btnSua_Click(object sender, EventArgs e)
73 {
74 string sql = "TenKhoiLop='" + txtTenKhoiLop.Text + "',MaHeDT='" + cmbMaHeDT.SelectedValue.ToString() + "',MaTDDT='" + cmbMaTDDT.SelectedValue.ToString() + "' where MaKhoiLop='" + txtMaKhoiLop.Text + "'";
75 business.Update("KhoiLop",sql);
76 FormKhoiLop_Load(sender, e);
77 }
File name: FormLop.cs
Copy
51 private void btnSua_Click(object sender, EventArgs e)
52 {
53 string sql = "TenLop='"+txtTenLop.Text+"',MaKhoiLop='"+cmbMaKhoiLop.SelectedValue.ToString()+"',MaGV='"+cmbMaGV.SelectedValue.ToString()+"' where MaLop='"+txtMaLop.Text+"'";
54 business.Update("Lop",sql);
55 FormLop_Load(sender,e);
56 }
File name: FormNhomHocPhan.cs
Copy
70 private void btnSua_Click(object sender, EventArgs e)
71 {
72 string sql = "TenNhomHP='" + txtTenNhomHP.Text + "',MaHP='" + cmbMaHP.SelectedValue.ToString() + "',MaKHGD='" + cmbMaKHGD.SelectedValue.ToString() + "',MaGV='" + cmbMaGV.SelectedValue.ToString() +"' where MaNhomHP='"+txtMaNhomHP.Text+"'";
73 business.Update("NhomHocPhan", sql);
74 FormNhomHocPhan_Load(sender, e);
75 }
File name: FormPhanQuyen.cs
Copy
75 private void btnSua_Click(object sender, EventArgs e)
76 {
77 string sql = "Password='" + txtMatKhau.Text + "',Quyen='" + cmbQuyen.SelectedItem.ToString() + "' where Username='"+txtTenDangNhap.Text+"'";
78 business.Update("Users",sql);
79 FormPhanQuyen_Load(sender, e);
80 }
Download file with original file name:Update
Update 211 lượt xem
Gõ tìm kiếm nhanh...