Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- String sql="Select * from Users1";
- String host ="jdbc:derby://localhost:1527/Nash";
- String uName = "CON";
- String uPass = "smokes";
- Connection con = DriverManager.getConnection(host, uName, uPass);
- Statement stmt=con.createStatement();
- ResultSet rs = stmt.executeQuery(sql);
- String user= userName.getText();
- String pwd= password.getText();
- while(rs.next()) {
- String uname=rs.getString("User_name");
- String pass=rs.getString("Password");
- String admin1=rs.getString("admin");
- if ((user.equals(uname)) && (pwd.equals(pass)))
- {
- if ((admin1.equals("y")))
- {
- mainPanel.setVisible(true);
- blankContent.setVisible(true);
- adminButton.setEnabled(true);
- receiptContent.setVisible(false);
- memberContent.setVisible(false);
- securityPanel.setVisible(false);
- }
- else
- {
- mainPanel.setVisible(true);
- blankContent.setVisible(true);
- adminButton.setEnabled(false);
- receiptContent.setVisible(false);
- memberContent.setVisible(false);
- securityPanel.setVisible(false);
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null, "User name and password do"
- + " not match!","ALERT!", JOptionPane.ERROR_MESSAGE);
- }
- } } catch (SQLException ex) {
- Logger.getLogger(program.class.getName()).log(Level.SEVERE, null, ex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement