Guest User

Untitled

a guest
Jan 17th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. String insertString = "INSERT INTO listings(Seller, Title, Close_Time, Price, Condition)"
  2. + " VALUES('"+par.getSellerName()+"', '"+par.getItemName()+"', "
  3. +closetime+", "+par.getPrice()+", '"+par.getCondition()+"')";
  4.  
  5. pst = con.prepareStatement(insertString);
  6. pst.executeUpdate();
  7. ResultSet rs = pst.getGeneratedKeys();
  8.  
  9. pst = con.prepareStatement(
  10. "INSERT INTO listings(Seller, Title, Close_Time, Price, Condition)"
  11. + "VALUES(?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS);
  12. pst.setString(1, par.getSellerName());
  13. pst.setString(2, par.getItemName());
  14. long closeTime = getTimeMills(par.getTimeOver());
  15. pst.setLong(3, closeTime);
  16. pst.setDouble(4, par.getPrice());
  17. pst.setString(5, par.getCondition());
  18. pst = con.prepareStatement(insertString);
  19. pst.executeUpdate();
  20. ResultSet rs = pst.getGeneratedKeys();
Add Comment
Please, Sign In to add comment