Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void mase(){
- String time=dateFormat.format(date);
- String SQLTIME="INSERT INTO history (UserActivityID, UserTimeActivity, UserActivity) VALUES (null,?,?)";
- try {
- JOptionPane.showMessageDialog(this, "?");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/atm?zeroDateTimeBehavior=convertToNull", "root", "");
- PreparedStatement prstm=con.prepareStatement(SQLTIME);
- prstm = con.prepareStatement(SQLTIME,PreparedStatement.RETURN_GENERATED_KEYS);
- prstm.setString(1, time);
- prstm.setString(2,"Cash Withdraw");
- int rowsInserted = prstm.executeUpdate();
- if (rowsInserted > 0) {
- JOptionPane.showMessageDialog(this," inserted successfully!");
- }
- } catch (SQLException | HeadlessException | ClassCastException ex) {
- JOptionPane.showMessageDialog(this, ex);
- }
- JOptionPane.showMessageDialog(this, time);
Add Comment
Please, Sign In to add comment