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

Create










                                                Berikut potongan syntax create

                                                Connection conDB = ConnectionDB.getConnection();

                                                            String         sql      =       "INSERT            INTO          product_hp
                                                (productCategory,productName,price,qty)                                          VALUES

                                                (?,?,?,?)";

                                                            PreparedStatement                                     ps                         =
                                                conDB.prepareStatement(sql);

                                                            ps.setString(1, product.getProductCategory());

                                                            ps.setString(2, product.getProductName());

                                                            ps.setDouble(3, product.getPrice());
                                                            ps.setInt(4, product.getQty());

                                                            ps.executeUpdate();
   13   14   15   16   17   18   19   20   21   22   23