i want to create this task, when administrator uses this program for first time he has to register but for the second time he doesn't have to register because he already did and he has to login .. I tried to retrieve the username and password from database then compare result Set if the result set is empty then let the register class to be open else let the login form to be open ... but I didn't work. what is the problem ???
@Override
public void mouseClicked(MouseEvent me) {
Object click = me.getSource();
if (click == buttonAcoutUS) {
new AboutUs();
dispose();
} else if (click == buttonAdmin) {
ifIDExit();
dispose();
}
}
public void ifIDExit(){
Connection con =myConnection.getConnection();
PreparedStatement ps;
ResultSet rs;
try {
ps=con.prepareStatement("SELECT * FROM `adminstrator` ");
rs=ps.executeQuery();
rs.next();
if (rs.equals("")) {
new newRegister();
}
else {
new AdminLogin();
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}