Guest User

Untitled

a guest
May 5th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public void mase(){
  2.  
  3. String time=dateFormat.format(date);
  4.  
  5. String SQLTIME="INSERT INTO history (UserActivityID, UserTimeActivity, UserActivity) VALUES (null,?,?)";
  6.  
  7. try {
  8. JOptionPane.showMessageDialog(this, "?");
  9.  
  10. Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/atm?zeroDateTimeBehavior=convertToNull", "root", "");
  11. PreparedStatement prstm=con.prepareStatement(SQLTIME);
  12. prstm = con.prepareStatement(SQLTIME,PreparedStatement.RETURN_GENERATED_KEYS);
  13.  
  14. prstm.setString(1, time);
  15. prstm.setString(2,"Cash Withdraw");
  16. int rowsInserted = prstm.executeUpdate();
  17. if (rowsInserted > 0) {
  18.  
  19. JOptionPane.showMessageDialog(this," inserted successfully!");
  20. }
  21.  
  22. } catch (SQLException | HeadlessException | ClassCastException ex) {
  23. JOptionPane.showMessageDialog(this, ex);
  24. }
  25. JOptionPane.showMessageDialog(this, time);
Add Comment
Please, Sign In to add comment