public ModificarAdm() { InitializeComponent(); DataGridActualizarE.DataSource = u.MostrarAdm(); try { CombAEm.DropDownStyle = ComboBoxStyle.DropDownList; CombAEm.Text = "Id"; CombAEm.Items.Clear(); conectar1.conectar(); conectar1.abrirConexion(); MySqlCommand comando = new MySqlCommand("SELECT usuario FROM encargado", conectar1.getconexion()); MySqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { CombAEm.Refresh(); CombAEm.Items.Add(lector.GetValue(0).ToString()); } conectar1.cerrarConexion(); } catch (MySqlException r) { MessageBox.Show(r.Message); } }
private void ActualizarEmpleado_Load(object sender, EventArgs e) { DataGridActualizarE.DataSource = TU.mostrarTablaUsuario(); try { CombAEm.DropDownStyle = ComboBoxStyle.DropDownList; CombAEm.Text = "Id"; CombAEm.Items.Clear(); conectar1.conectar(); conectar1.abrirConexion(); MySqlCommand comando = new MySqlCommand("SELECT id_empleado FROM empleado", conectar1.getconexion()); MySqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { CombAEm.Refresh(); CombAEm.Items.Add(lector.GetValue(0).ToString()); } conectar1.cerrarConexion(); } catch (MySqlException h) { MessageBox.Show(h.Message); } }