 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Berthold Stahn Guest
|
Posted: Sun Jul 02, 2006 9:51 pm Post subject: TADOQuery and AD multi valued properties |
|
|
Hi ,
I'm trying to use ADsDSOObject provider and TADOQuery to list the members
of a security group from Active Directory. When trying to read the
property Member,
the programs responds with: Cannot convert array variant to string.
I'm using a "normal" TDBGrid to display the results. It's works fine for
single valued properties.
Any ideas ??
Thank you for helping me.
Berthold |
|
| Back to top |
|
 |
Berthold Stahn Guest
|
Posted: Wed Nov 01, 2006 4:19 pm Post subject: Re: TADOQuery and AD multi valued properties |
|
|
Hi ,
no answer yet - but I've some which helps me:
there are some wrappers to deal with variants and safearrays:
void __fastcall TfrmAnzeige::lvGroupsSelectItem(TObject *Sender,
TListItem *Item, bool Selected)
{
TListItem *ListItem;
TVariantT<VARIANT> varMember;
TVariantT<VARIANT> varElement;
SAFEARRAY* pSA;
TSafeArrayT<VARIANT, VT_VARIANT, 1> varArray;
if (Selected)
{
ListItem = lvMember->Items->Add();
ListItem->Caption = "***** " + Item->Caption + " *****";
cmdLDAP2->CommandText = "Select cn,adsPath,member FROM " +
QuotedStr(Item->SubItems->Strings[0]);
dsLDAP2->Recordset = cmdLDAP2->Execute();
varMember = dsLDAP2->Fields->FieldByName("member")->AsVariant;
pSA = varMember;
varArray.Attach(pSA);
for (int i=0; i < varArray.BoundsLength[0]; i++)
{
varElement = VARIANT(varArray[i]);
ListItem = lvMember->Items->Add();
ListItem->Caption = AnsiString(varElement);
}
}
}
lvMember, lvGroups are TListViews and cmdLDAP2 is TADOCommand
As the event is fired twice, I've used "if (Selected)" to perform only
when the item is selected.
"Berthold Stahn" <Berthold.Stahn@teleos-web.de> schrieb im Newsbeitrag
news:44a7f9b9 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi ,
I'm trying to use ADsDSOObject provider and TADOQuery to list the
members
of a security group from Active Directory. When trying to read the
property Member,
the programs responds with: Cannot convert array variant to string.
I'm using a "normal" TDBGrid to display the results. It's works fine for
single valued properties.
Any ideas ??
Thank you for helping me.
Berthold |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|