This is may one class. Now i want to create a new class registrationvalidator
extending LoginValidator
. i tried by
public class registrationvalidator extends LoginValidator {
}
But its show error in netbeans...What is the soluation?
public LoginValidator() throws SQLException{
try {
connect = new Dbconnect();
st = connect.Statement();
} catch (SQLException ex) {
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
public int validator(String mobileNo,String pass){
int ret = 0;
try{
String query="select * from login where mobileNo='"+mobileNo+"'";
res= st.executeQuery(query);
while(res.next()){
String dbMobileNo=res.getString("mobileNo");
String dbPass=res.getString("password");
if(mobileNo.equals(dbMobileNo) && pass.equals(dbPass)){
ret=1;
}
else if(mobileNo.equals(dbMobileNo)){
ret=2;
}
}
}catch(SQLException ex){
System.out.println("Sql Execption: "+ex);
System.out.println("3");
}
return ret;
}
}
A few things here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.