private void btnthem_Click(object sender, EventArgs e) { try { if (txtmaluat.Text != "" && txtnoidung.Text != "") { rules l = new rules(); l.Maluat = txtmaluat.Text; l.Noidung = txtnoidung.Text; xl.them(l); dataluat.DataSource = xl.loadluat(); txtmaluat.Text = ""; txtnoidung.Text = ""; } else { MessageBox.Show("Не оставляйте пустым!"); } } catch { MessageBox.Show("добавить успешно!"); } }
public void sua(rules l) { String sql = "update tblluat set noidung = N'" + l.Noidung + "' where maluat = '" + l.Maluat + "' "; kn.thuchien(sql); }
public void them(rules l) { String sql = "insert into tblluat values('" + l.Maluat + "',N'" + l.Noidung + "')"; kn.thuchien(sql); }