This is only the code behind login button !!!
If you wish to make login page then use this, Simple code for access in a web using user name and password with database connectivity using stored procedure..
private void jButton2ActionPerformed(java.
        // TODO add your handling code here:
        String user = jTextField2.getText();
        String strpass = jPasswordField2.getText();
        try {
            // TODO add your handling code here:
            Connection con = DBConnection.getDBConnection()
            CallableStatement cs = con.prepareCall("{call USP_LOGIN(?,?)}");
            cs.setString(1, user);
            cs.setString(2, strpass);
            cs.executeQuery();
            ResultSet rs = cs.getResultSet();
            boolean recordfound = rs.next();
            if(recordfound)
            { Desktop.removeAll();  
     Desktop.repaint();  
     Home home = new Home();
   home.setBounds(0, 0, 1280, 980);
     Desktop.add(home);  
     home.setVisible(true); 
     home.jLabel1.setText("WELCOME : "+user);
            }
            else {
                jLabel10.setText("Invalid User ID And Password");
            }    
            } catch (SQLException ex) {
            Logger.getLogger(index.class.
        }
    }        
 
No comments:
Post a Comment