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

private void eliminarActionPerformed(java.awt.event.ActionEvent evt) { try{ String sql = "DELETE FROM datos WHERE id=?"; PreparedStatement pst = con.prepareStatement(sql); pst.setInt(1,Integer.parseInt(id.getText())); pst.execute(); JOptionPane.showMessageDialog(null,"Eliminado exitosamente"); }catch(Exception e){ JOptionPane.showMessageDialog(null,"No se ha podido eliminar"); } mostrarDatos(); }

Want to kickstart your project?Use the new AI Studio to create your code