Good morning,
I have the following code in Java Desktop. I wanted to know how I can capture that user's group and save it to a variable. Since when it returns the value and stores in the variable "rs" does not contain information understood for the developer. It needs the user's group name to open a jframe according to its group.
public class UsuarioD {
public static Boolean doLogin(model.UsuarioM usuario) {
// Variáveis
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from usuario where nome=? and senha=?";
try {
// Validar
ps = ConectarDB.getConexao().prepareStatement(sql);
ps.setString(1, usuario.getNome());
ps.setString(2, usuario.getSenha());
rs = ps.executeQuery();
// Validar
if(rs.next()) {
return true;
} else {
return false;
}
} catch (SQLException ex) {
ex.printStackTrace();
return false;
}
}
}