Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean saveToDatabase() {//////////////////////////creating phone //method to get custID before posting from page
- boolean saved = false;
- Connection c = DBHelperClass.getConnection();
- if (c != null) {
- try {
- Statement s = c.createStatement();
- String template = "INSERT INTO phones (custID, brand ) VALUES (?, ?)";
- PreparedStatement inserter = c.prepareStatement(template);
- inserter.setInt(1, this.custID);
- inserter.setString(2, this.brand);
- inserter.executeUpdate();
- saved = true;
- } catch (SQLException ex) {
- Logger.getLogger(Customer_phoneAuction.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- return saved;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement