How can I send data from MySql DB to another MySql data base

I have these issue, I want to take this information from an existent DB and the use a split to get just the first char from the information including date, and send to another DB using JavaScript. This is an electron app, so I need to use these technologies.

// Importar el módulo ipcRenderer de Electron
const { ipcRenderer } = require('electron');

// Obtener el botón y el campo de búsqueda
const searchButton = document.getElementById('BotonBuscar');
const searchInput = document.getElementById('BuscarUsuario');

// Función para formatear la fecha de nacimiento
function formatFechaNacimiento(fechaNacimiento) {
    var fechaCompleta = new Date(fechaNacimiento);
    var dia = fechaCompleta.getDate().toString().padStart(2, '0');  // Asegura dos dígitos
    var mes = (fechaCompleta.getMonth() + 1).toString().padStart(2, '0');  // Asegura dos dígitos, suma 1 porque getMonth() devuelve 0-11
    var año = fechaCompleta.getFullYear();
    return dia + '/' + mes + '/' + año;  // Cambia '/' por '-' si prefieres "DD-MM-YYYY"
}

// Función para cargar y mostrar los usuarios en la tabla
function loadUsers(users) {
    // Selecciona el cuerpo de la tabla donde se mostrarán los usuarios
    const tbody = document.querySelector('#userTable tbody');
    
    // Limpia las filas existentes en el cuerpo de la tabla
    tbody.innerHTML = '';

    users.forEach(user => {
        // Crea una nueva fila de tabla para cada usuario
        const row = document.createElement('tr');
        
        // Formatea la fecha de nacimiento para cada usuario
        const fechaFormateada = formatFechaNacimiento(user.Fecha_Nacimiento);
        
        // Llena la fila con los datos del usuario y botones de acción
        row.innerHTML = `
            <td>${user.Id}</td>
            <td>${user.Primer_Nombre}</td>
            <td>${user.Primer_Apellido}</td>
            <td>
                <button class="btn btn-outline-warning">Editar</button>
                <button class="btn btn-outline-danger">Eliminar</button>
                <button class="btn btn-outline-success" type="button" data-bs-toggle="modal" data-bs-target="#modalcrear">Agregar</button>
            </td>
        `;
        
        // Agrega la fila al cuerpo de la tabla
        tbody.appendChild(row);
        //I need to take this elements into a new var to manipulate them before send to the other DB
            document.getElementById('primernombre').value = user.Primer_Nombre;
            document.getElementById('segundonombre').value = user.Segundo_Nombre;
            document.getElementById('primerapellido').value = user.Primer_Apellido;
            document.getElementById('segundoapellido').value = user.Segundo_Apellido;
            document.getElementById('fechaNacimiento').innerText = formatFechaNacimiento(user.Fecha_Nacimiento);
    });

}

// Manejar el evento de clic del botón de búsqueda
searchButton.addEventListener('click', () => {
    const idUsuario = searchInput.value.trim();
    ipcRenderer.invoke('get-users', idUsuario).then(loadUsers).catch(err => {
        console.error('Error al buscar los usuarios:', err);
    });
}).catch(err => {
    // Manejar cualquier error al obtener los usuarios
    console.error('Error al cargar los usuarios:', err);
});

I have tried doing this

// Asignar elementos del DOM a variables
const primerNombreInput = document.getElementById('primernombre');
const segundoNombreInput = document.getElementById('segundonombre');
const primerApellidoInput = document.getElementById('primerapellido');
const segundoApellidoInput = document.getElementById('segundoapellido');
const fechaNacimientoLabel = document.getElementById('fechaNacimiento');

// Actualizar los valores de los campos con los datos del usuario
primerNombreInput.value = user.Primer_Nombre;
segundoNombreInput.value = user.Segundo_Nombre;
primerApellidoInput.value = user.Primer_Apellido;
segundoApellidoInput.value = user.Segundo_Apellido;
fechaNacimientoLabel.innerText = formatFechaNacimiento(user.Fecha_Nacimiento);

but it doesnt work, the values have not the variables.

New contributor

Ho Sung Choi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật