Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String dtl = null;
- ResultSet rs = null;
- String p = null;
- String Password = new String(pwPass.getPassword());
- /*check database to see if user has registered */
- try{
- if(txtUser.getText().isEmpty()){
- JOptionPane.showMessageDialog(this, "Please Enter a Username");
- }
- else if(pwPass.getPassword() == null){
- JOptionPane.showMessageDialog(this, "Please Enter a Password");
- }
- else{
- dtl = "SELECT Password FROM tblUsers WHERE Username = '" + txtUser.getText() + "'";
- rs = s.executeQuery(dtl);
- }
- while(rs.next()){
- p = rs.getString(1);
- }
- {
- if (Password.equals(p)){
- new Menu().setVisible(true);
- dispose();
- }
- /*if the password is correct allow them to login and open the Main Menu*/
- else{
- JOptionPane.showMessageDialog(this, "Login Information Incorrect Please Try again");
- }
- }
- }catch (Exception e){
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement