Guest User

CHANGE PASS

a guest
Sep 22nd, 2018
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1.  
  2. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
  3. // TODO add your handling code here:
  4. String pass =jPasswordField1.getText();
  5. String conPass =jPasswordField2.getText();
  6. uName =jTextField1.getText();
  7.  
  8. try
  9. {
  10. Class.forName("org.apache.derby.jdbc.ClientDriver");
  11. Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/salaryManagement","salary","pass");
  12. Statement st = con.createStatement();
  13. //String sql ="UPDATE LOGSIGN SET PASS ='"+pass+"' WHERE USERNAME='"+uName+"'" ;
  14.  
  15.  
  16. if(pass.equals(conPass))
  17. {
  18. //st.executeUpdate(sql);
  19. st.executeUpdate("UPDATE LOGSIGN SET PASS='" + pass +"' WHERE USERNAME='" +uName+ "'");
  20. JOptionPane.showMessageDialog(null,"Password Changed");
  21. }
  22. else
  23. {
  24. JOptionPane.showMessageDialog(null,"ERROR");
  25. }
  26. }
  27.  
  28. catch(HeadlessException | SQLException e)
  29. {
  30. System.out.print(e);
  31. } catch (ClassNotFoundException ex) {
  32. Logger.getLogger(forgotPass.class.getName()).log(Level.SEVERE, null, ex);
  33. }
  34. }
Add Comment
Please, Sign In to add comment