Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. String s1 = PasswordText4.getText();
  2. String s2 = ConfirmText4.getText();
  3. String s3 = NameText4.getText();
  4. String s4 = UsernameText4.getText();
  5. String s5 = jLabel16.getText();
  6.  
  7. if (PasswordText4.getText().equals(ConfirmText4.getText()) && s1.length() != 0 && s3.length() != 0 && s1.length() >= 4 && s2.length() >= 4) {
  8. try {
  9. String sql
  10. = "BEGIN"
  11. + "UPDATE LOGIN SET USERNAME = ?, PASSWORD = ?, NAME = ?"
  12. + "WHERE USERNAME = ?;"
  13. + "commit;"
  14. + "END;";
  15. CallableStatement cstmt = conn.prepareCall(sql);
  16. cstmt.setString(1, UsernameText4.getText());
  17. cstmt.setString(2, PasswordText4.getText());
  18. cstmt.setString(3, NameText4.getText());
  19. cstmt.setString(4, jLabel16.getText());
  20.  
  21. //System.out.println(jLabel16.getText());
  22.  
  23. int dialogButton = JOptionPane.YES_NO_OPTION;
  24. int dialogResult = JOptionPane.showConfirmDialog(null, "Are you sure you want to update?", "Warning", dialogButton);
  25. if (dialogResult == JOptionPane.YES_OPTION) {
  26. cstmt.execute();
  27. JOptionPane.showMessageDialog(null, "Information Updated");
  28. jLabel15.setText(NameText4.getText());
  29. jLabel16.setText(UsernameText4.getText());
  30. jLabel17.setText(PasswordText4.getText());
  31. }
  32.  
  33. } catch (Exception e) {
  34. JOptionPane.showMessageDialog(null, e);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement