//***********POBLAR COMBOBOX ******************************* //Llena lista de tablas public void LlenarItems(ComboBox cb) { try { SqlCommand cmd = new SqlCommand("SELECT DESCRIPCION FROM t_comisiones_tablas", obj.Abrir()); Dr = cmd.ExecuteReader(); while (Dr.Read()) { cb.Items.Add(Dr["DESCRIPCION"].ToString()); } Dr.Close(); } catch (Exception ex) { MessageBox.Show("No se obtuvieron registros: " + ex.ToString()); } }
//**************** public DataTable CargarTabla() { try { //string LiquidarEsquema1 = Form1.Variables.LiquidarEsquema; //LiquidarEsquema1 = comboBox1.Text.Trim();//String //MessageBox.Show("EXEC " + sp + " '"+F1+"','"+F2+"'"); DataTable dt = new DataTable(); SqlCommand comando = new SqlCommand("EXEC " + sp + " '" + F1 + "','" + F2 + "'", obj.Abrir());//"+ LiquidarEsquema + " comando.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(comando); da.Fill(dt); return(dt); } catch (Exception) { return(null); } }
//private void button1_Click(object sender, EventArgs e) //{ // Form Validauser = new Form1(); // Validauser.Show(); // this.Hide(); //} public void ValidaUserAutorizado() { string var_validauser = Usuario.Text.Trim(); // MessageBox.Show("Usuario en Query: " + var_validauser); try { SqlCommand cmd = new SqlCommand("SELECT USUARIO FROM t_comisiones_users WHERE USUARIO='" + var_validauser + "'", obj.Abrir()); Dr3 = cmd.ExecuteReader(); while (Dr3.Read()) { userdevuelto = Dr3["USUARIO"].ToString(); } Dr3.Close(); } catch (Exception ex) { MessageBox.Show("No se obtuvieron registros: " + ex.ToString()); } }
//***********POBLAR COMBOBOX ******************************* public void LlenarItems(ComboBox cb) { try { SqlCommand cmd = new SqlCommand("SELECT DISTINCT(UNIDAD_NEGOCIO) FROM t_comisiones_esquemas order by 1 asc", obj.Abrir()); Dr = cmd.ExecuteReader(); while (Dr.Read()) { cb.Items.Add(Dr["UNIDAD_NEGOCIO"].ToString()); } Dr.Close(); } catch (Exception ex) { MessageBox.Show("No se obtuvieron registros: " + ex.ToString()); } }