private void LoadData() { try { dt = new DataTable(); dt.Clear(); DataSet ds = kh.LayKhachHang(); dt = ds.Tables[0]; DgvKH.DataSource = dt; tbTen.ResetText(); btThem.Enabled = true; btSua.Enabled = true; BtXoa.Enabled = true; btnReload.Enabled = true; btnThoat.Enabled = true; btLuu.Enabled = false; btnHuy.Enabled = false; cbGioiTinh.SelectedIndex = 0; //Load Dữ liệu Thành Phố lên combo box cmbThanhPho.DataSource = tp.LayThanhPho().Tables[0]; cmbThanhPho.DisplayMember = "TenThanhPho"; cmbThanhPho.ValueMember = "MaThanhPho"; DgvKH_CellClick(null, null); } catch (Exception errr) { MessageBox.Show(errr.Message); } }
public void LoadData() { try { dataTable = new DataTable(); dataTable.Clear(); DataSet ds = TP.LayThanhPho(); dataTable = ds.Tables[0]; dgvThanhPho.DataSource = dataTable; } catch (SqlException errr) { MessageBox.Show(errr.Message); } txtTenTP.ResetText(); btThem.Enabled = true; btSua.Enabled = true; BtXoa.Enabled = true; btnReload.Enabled = true; btnThoat.Enabled = true; btLuu.Enabled = false; btnHuy.Enabled = false; }