public static void load_data_to_combobox_with_query(ComboBox ip_cbo, string ip_str_value_field, string ip_str_display_field, eTAT_CA ip_e_tat_ca, string ip_query) { US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); DataSet v_ds = new DataSet(); DataTable v_dt = new DataTable(); v_ds.Tables.Add(v_dt); v_us.FillDatasetWithQuery(v_ds, ip_query); ip_cbo.DisplayMember = ip_str_display_field; ip_cbo.ValueMember = ip_str_value_field; ip_cbo.DataSource = v_ds.Tables[0]; if (ip_e_tat_ca == eTAT_CA.YES) { DataRow v_dr = v_ds.Tables[0].NewRow(); v_dr[0] = -1; v_dr[1] = "------ Tất cả ------"; v_ds.Tables[0].Rows.InsertAt(v_dr, 0); ip_cbo.SelectedIndex = 0; } else { ip_cbo.SelectedIndex = 0; } }
public static void load_data_to_auto_complete_source(string ip_str_table_name, string ip_str_column_name, TextBox ip_txt) { US_DUNG_CHUNG v_us = new US_DUNG_CHUNG(); DataSet v_ds = new DataSet(); DataTable v_dt = new DataTable(); v_ds.Tables.Add(v_dt); v_us.FillDatasetWithProc(v_ds, ip_str_table_name, ip_str_column_name); for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++) { DataRow v_dr = v_ds.Tables[0].Rows[i]; ip_txt.AutoCompleteCustomSource.Add(v_dr[ip_str_column_name].ToString()); } }