hi friends,
i myself found the solution for the java prog which i was unable to do, in my last article..
the solution is
the connecting function in the 2nd class..
public boolean UsrAuthPw(String username, String password){
boolean status = false;
try{
Connection con = getconnect();
Statement s = con.createStatement();
System.out.println("Username : "+ username +" Password : "+ password );
ResultSet rs = s.executeQuery("SELECT UserId, Password from usrauth where UserId = '"+ username +"' and Password = '"+ password +"'");
while (rs.next()){
status = true;
}
}
catch(java.sql.SQLException sqlexcp){
sqlexcp.printStackTrace();
System.out.println("SQL Exception");
status = false;
}
return status;
}
and the actionPerformed function of the 3rd class is,
public void actionPerformed(ActionEvent e){
String s1 = t1.getText();
String s2 = t2.getText();
if (s1.equals(s2)){
l3.setText("Both are same");
} else {
UsrConn uc = new UsrConn();
uc.getconnect();
boolean b = uc.UsrAuthPw(s1, s2);
if (b == true){
l3.setText("User logged in");
}
else{
l3.setText("Incorrect UserId or Password");
}
}