Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages
Started by Berthold Stahn
Sun, 02 Jul 2006 16:51
TADOQuery and AD multi valued properties
Author: Berthold Stahn
Date: Sun, 02 Jul 2006 16:51
Date: Sun, 02 Jul 2006 16:51
17 lines
1479 bytes
1479 bytes
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
Re: TADOQuery and AD multi valued properties
Author: Berthold Stahn
Date: Wed, 01 Nov 2006 10:19
Date: Wed, 01 Nov 2006 10:19
57 lines
2936 bytes
2936 bytes
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@newsgroups.borland.com...
> 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads