Do not delete in database

0

This is my code, there is no error but deleting does not delete me in the phpmyadmin database.

int fila = tabladatos.getSelectedRow();

    String sql = "DELETE FROM clientes WHERE Id_cliente = ?";

    if (fila >= 0) {

        try {

            PreparedStatement ps = cn.prepareStatement(sql);

            ps.setString(1, Id_cliente.getText());  

            ps.executeUpdate();

            mostrartabla();

            limpiar();

            JOptionPane.showMessageDialog(null, "Datos eliminados");

        } catch (SQLException e) {

            System.out.println(e);
        }
    }
    
asked by Pablo P 11.07.2017 в 16:36
source

1 answer

0

Change this:

ps.setString(1, Id_cliente.getText()); 

for

ps.setInt(1, Integer.parseInt(Id_cliente.getText())); 
    
answered by 11.07.2017 в 18:06