Page 24 - Abstract Class, Interface & Struktur Data
P. 24

Delete











             Berikut potongan syntax delete



             try {


                         Connection conDB = ConnectionDB.getConnection();



                         String sql = "DELETE FROM product_hp WHERE productId=?";


                         PreparedStatement ps = conDB.prepareStatement(sql);



                         ps.setInt(1, product.getProductId());



                         ps.executeUpdate();


                         System.out.println("Data has been delete");



                     }
   19   20   21   22   23   24   25   26