private void frmNhacc_Load(object sender, EventArgs e) { NhaccBUL cls = new NhaccBUL(); dataGridView1.DataSource = cls.Danhsachnhacungcap(); dataGridView1.AutoResizeColumns(); }
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"); } }