private void LoadMaKH() { try { if (txtTenKH.Text != "") { try { DataTable tblTenKH = Khachhang_BUS.Khachhang_LoadMaTen(); int j = 0; foreach (DataRow dr in tblTenKH.Rows) { if (txtTenKH.Text == dr["TENKH"].ToString()) { txtMaKH.Text = dr["MAKH"].ToString(); return; } else { j++; } } txtMaKH.Text = ""; } catch (Exception ex) { MessageBox.Show("Can not open connection ! "); } } } catch (Exception ex) { } }
private void getDataTenKH(AutoCompleteStringCollection dataCollection) { try { DataTable tblTenKH = Khachhang_BUS.Khachhang_LoadMaTen(); int i = 0; foreach (DataRow dr in tblTenKH.Rows) { dataCollection.Add(dr["TENKH"].ToString()); i++; } } catch (Exception ex) { MessageBox.Show("Can not open connection ! "); } }
private string LoadMaKH() { DataTable tblTenKH = Khachhang_BUS.Khachhang_LoadMaTen(); int j = 0; foreach (DataRow dr in tblTenKH.Rows) { if (txtTenKH.Text == dr["TENKH"].ToString()) { return(dr["MAKH"].ToString()); } else { j++; } } return(""); }