Hi,
I'm trying to check the login.
The values of id and pw are send from a textbox and the values of userid and password are from a mysql database. I try to compare them and if they are equal i want to return true and else return false. But i always get the missing return statement error.
And if I put my return somewhere else i get the unreachable statement error. Can someone help me?

  public Boolean CheckLogin(int id, String pw) 
    {  [B]// missing return statement error [/B] 
       try
       {   
        int userid = 0;
        String password = "";
        ResultSet rs = null;
        rs = KrijgLogin.executeQuery();
        userid = rs.getInt("userid");
        password = rs.getString("wachtwoord");
        if (userid == id && wachtwoord.equals(pw))
        {
            return true;
        }
        else 
        {
            return false;
        }
         } catch (SQLException ex) {

         }    
    }

In case there is an error, there is no return from your catch statement...

catch (SQLException ex) {
return false;
}

Add this and try again. As ur catch exception dont have return thats y u are encountering this error.

problem solved!
thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.