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 delete(int n) { String sql = "DELETE FROM product WHERE id =?"; try (Connection conn = this.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) { pstmt.setInt(1, n); pstmt.executeUpdate(); } catch (SQLException e) { System.out.println(e.getMessage()); } }

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