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) { // missing return statement error 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...