public int Themnhacc(NhaccPublic p) { int Nparameter = 4; string[] name = new string[Nparameter]; object[] value = new object[Nparameter]; name[0] = "@MaNCC"; name[1] = "@TenNCC"; name[2] = "@Dchi"; name[3] = "@Dthoai"; value[0] = p.Mancc; value[1] = p.Tenncc; value[2] = p.Dchi; value[3] = p.Dthoai; return(cn.Update("insert into NHACUNGCAP values(@MaNCC,@TenNCC,@Dchi,@Dthoai)", name, value, Nparameter)); }
private void btnInsert_Click(object sender, EventArgs e) { try { NhaccBUL cls = new NhaccBUL(); NhaccPublic p = new NhaccPublic(); p.Mancc = txtMancc.Text; p.Tenncc = txtTenncc.Text; p.Dchi = txtDchi.Text; p.Dthoai = txtDthoai.Text; cls.Themnhacc(p); frmNhacc_Load(sender, e); } catch (SqlException) { MessageBox.Show("Lỗi không thêm được Nhà cung cấp"); } }
public int Themnhacc(NhaccPublic p) { return(cls.Themnhacc(p)); }