problem when updating MySQL DB with ResultSet

0

I have a problem updating my MySQL DB with a ResultSet. Current source attachment.

public void insertaTabla(Object[] empleados) throws SQLException{

    modelo.insertRow(modelo.getRowCount(), empleados);

    int ultimaFila = modelo.getRowCount() - 1;

    Object idEmp = modelo.getValueAt(ultimaFila, 0);
    Object nombre = modelo.getValueAt(ultimaFila, 1);
    Object apellido = modelo.getValueAt(ultimaFila, 2);
    Object feAlta = modelo.getValueAt(ultimaFila, 3);
    Object sueldo = modelo.getValueAt(ultimaFila, 4);
    Object totalVentas = modelo.getValueAt(ultimaFila, 5);
    Object idDep = modelo.getValueAt(ultimaFila, 6);

    rs.updateObject("idEmp", idEmp);
    rs.updateObject("nombre", nombre);
    rs.updateObject("apellido", apellido);
    rs.updateObject("feAlta", feAlta);
    rs.updateObject("sueldo", sueldo);
    rs.updateObject("totalVentas", totalVentas);
    rs.updateObject("idDep", idDep);

    rs.insertRow();

    validate();
    repaint();
}

This is the code that I inserted in the JTable, and from this I have to update my database, but it returns a null pointer in this line rs.updateObject ("idEmp", idEmp);

I have the ResultSet defined as a class attribute and then I use it to fill the JTable. The values are received from the array of Object that is passed to the method by employees and does not arrive empty, I have already checked it. I have to clarify, I'm not too sure about doing this with ResultSet (I do not have much experience with this) but I have to do it that way.

greetings and thanks in advance

    
asked by daviserraalonso 18.04.2018 в 11:06
source

0 answers