LexarG56

Generation

generate functionWed, 19 Jul 2023

En el actionperformed del boton eliminar, que se pueda eliminar un dato registrado tipo int en una base de datos

public void actionPerformed(ActionEvent e) { if (e.getSource() == btnEliminar) { try { String sql = "DELETE FROM registro WHERE id = ?"; PreparedStatement st = conexion.prepareStatement(sql); st.setInt(1, Integer.parseInt(this.txtID.getText())); st.executeUpdate(); updateTable(); } catch (Exception e2) { e2.printStackTrace(); } } }

Questions about programming?Chat with your personal AI assistant