Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1.  String dtl = null;
  2.           ResultSet rs = null;
  3.           String p = null;
  4.           String Password = new String(pwPass.getPassword());
  5.  
  6.      /*check database to see if user has registered */
  7.      try{
  8.             if(txtUser.getText().isEmpty()){
  9.                  JOptionPane.showMessageDialog(this, "Please Enter a Username");
  10.  
  11.             }
  12.              else if(pwPass.getPassword() == null){
  13.                  JOptionPane.showMessageDialog(this, "Please Enter a Password");
  14.              }
  15.              else{
  16.  
  17.              dtl = "SELECT Password FROM tblUsers WHERE Username = '" + txtUser.getText() + "'";
  18.              rs = s.executeQuery(dtl);
  19.              
  20.              }
  21.  
  22.             while(rs.next()){
  23.                 p = rs.getString(1);
  24.             }
  25.             {
  26.  
  27.             if (Password.equals(p)){
  28.                
  29.                
  30.                 new Menu().setVisible(true);
  31.                 dispose();
  32.             }
  33.  
  34.             /*if the password is correct allow them to login and open the Main Menu*/
  35.            
  36.                
  37.            
  38.             else{
  39.             JOptionPane.showMessageDialog(this, "Login Information Incorrect Please Try again");
  40.             }
  41.         }
  42.  
  43.     }catch (Exception e){
  44.     e.printStackTrace();
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement