public void Xoa(QLKTX.BusinessObject.QuocTichInfo qt) { SqlCommand s = new SqlCommand("Delete QUOCTICH where MAQuocTich=@ma"); s.Parameters.Add("@ma", SqlDbType.Int).Value = qt.MaQuocTich; ser.Load(s); }
public void Sua(QLKTX.BusinessObject.QuocTichInfo qt) { SqlCommand s = new SqlCommand("Update QUOCTICH set TENQUOCTICH = @ten where MAQuocTich= @ma"); s.Parameters.Add("@ten", SqlDbType.NVarChar, 30).Value = qt.TenQuocTich; s.Parameters.Add("@ma", SqlDbType.Int).Value = qt.MaQuocTich; ser.Load(s); }
public void Them(QLKTX.BusinessObject.QuocTichInfo qt) { SqlCommand s = new SqlCommand("INSERT INTO QUOCTICH(MAQUOCTICH,TENQUOCTICH) VALUES(@ma,@ten)"); s.Parameters.Add("@ten", SqlDbType.NVarChar, 30).Value = qt.TenQuocTich; s.Parameters.Add("@ma", SqlDbType.Int).Value = qt.MaQuocTich; ser.Load(s); }
private void btnLuu_Click(object sender, EventArgs e) { if (txtTen.Text != "") { QLKTX.BusinessObject.QuocTichInfo qt = new QLKTX.BusinessObject.QuocTichInfo(); qt.MaQuocTich = Convert.ToInt32(txtMa.Text); qt.TenQuocTich = txtTen.Text.ToString(); ctl.Them(qt); DialogResult = DialogResult.Yes; } else { MessageBox.Show("Chưa nhập Tên!", "Quốc Tịch", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Sua(QLKTX.BusinessObject.QuocTichInfo i) { QuocTichData data = new QuocTichData(); data.Sua(i); }
public void Them(QLKTX.BusinessObject.QuocTichInfo i) { QuocTichData data = new QuocTichData(); data.Them(i); }