public void Update(SuKien sk) { String sql = "Update tblsukien motasukien = N'" + sk.MotaSuKien + "', loaisukien='" + sk.LoaiSuKien + "' where masukien = '" + sk.MaSuKien + "' "; //cn.Run(sql); provider.Run(sql); }
public void Insert(SuKien sk) { String sql = "Insert into tblsukien values('" + sk.MaSuKien + "',N'" + sk.MotaSuKien + "','" + sk.LoaiSuKien + "')"; //cn.Run(sql); provider.Run(sql); }
private void BtnSua_Click(object sender, EventArgs e) { SuKien sk = new SuKien(); sk.MaSuKien = txtMaSK.Text; sk.MotaSuKien = txtMoTaSK.Text; sk.LoaiSuKien = cmbLoaiSK.SelectedValue.ToString(); xl.Update(sk); dataSuKien.DataSource = xl.LoadSuKien(); }
private void BtnThem_Click(object sender, EventArgs e) { try { if (txtMaSK.Text != "" && txtMoTaSK.Text != "") { SuKien sk = new SuKien(); sk.MaSuKien = txtMaSK.Text; sk.MotaSuKien = txtMoTaSK.Text; sk.LoaiSuKien = cmbLoaiSK.SelectedValue.ToString(); xl.Insert(sk); dataSuKien.DataSource = xl.LoadSuKien(); } else { MessageBox.Show("Không được để trống!"); } } catch (Exception) { throw; } }