0

after a little bit of trying I managed to get results from the ldap-server at my company. Now I have a little problem and I seem to be too dump to find any documentation about it.

Command objCmd = new Command();
Recordset RS = new Recordset();
objCmd.setActiveConnection(conn);
objCmd.setCommandText("<LDAP://scdldap.siemens.net:389>;(&(objectClass=scdInternetPerson)(mail=" + email + "));" +searchKeyword+";subTree");

RS = objCmd.Execute();

if (RS.getBOF())
    System.out.printf(email + ";" + "null" + "\n");
else {
    RS.MoveFirst();
    System.out.printf(email + ";" + RS.getFields().getItem(0).getValue() + "\n");
}

This works fine as long as I print the result out to the console. But I would need to get the value as a String (it is always a String), but I can't make it. Can somebody tell me what I am missing? I know this is some VariableType Error, because the result is of type Variant, but Variant.toString() or anything else is not possible.

Patrick.H
  • 535
  • 3
  • 6
  • 21

1 Answers1

0

Try to convert Variant to Object and then to String, for example:

Variant From = new Variant(1);  
Variant To = new Variant(6);  
Object[] args = new Object[]{From, To};
String From1 = args[0].toString();
String To1 = args[1].toString();
Summer256
  • 56
  • 5