public void editar()
 {
     try
     {
         MySqlConnection conexionMysql = new MySqlConnection(connectionString);
         MySqlCommand    command       = conexionMysql.CreateCommand();
         command.CommandText = "select id, usuario, contraseña, tipo, foto from usuarios where id='" + Convert.ToString(id) + "' and enabled=1;";
         conexionMysql.Open();
         MySqlDataReader reader = command.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 FormCrudEmpleados formCargaEditar = new FormCrudEmpleados();
                 formCargaEditar.tbxUsuario.Text          = Convert.ToString(reader["usuario"]);
                 formCargaEditar.tbxContraseña.Text       = Convert.ToString(reader["contraseña"]);
                 formCargaEditar.tbxRContraseña.Text      = Convert.ToString(reader["contraseña"]);
                 formCargaEditar.CbxTipo.Text             = Convert.ToString(reader["tipo"]);
                 formCargaEditar.pbxEmploye.ImageLocation = Convert.ToString(reader["foto"]);
                 formCargaEditar.tbxId.Text         = Convert.ToString(reader["id"]);
                 formCargaEditar.btnAgregar.Visible = false;
                 formCargaEditar.Show();
             }
         }
         else
         {
             MessageBox.Show("Selecciona Registro", "EDITAR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (MySqlException)
     {
         MessageBox.Show("La conexion no ha tenido exito", "base datos", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            FormCrudEmpleados addEmploye = new FormCrudEmpleados();

            addEmploye.btnModificar.Visible = false;
            addEmploye.Show();
        }
示例#3
0
        private void aGREGARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormCrudEmpleados employe = new FormCrudEmpleados();

            employe.btncerrar.Visible    = false;
            employe.btnModificar.Visible = false;
            openCrudEmploye(employe);
        }