BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TADOQuery and AD multi valued properties

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Berthold Stahn
Guest





PostPosted: Sun Jul 02, 2006 9:51 pm    Post subject: TADOQuery and AD multi valued properties Reply with 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
Berthold Stahn
Guest





PostPosted: Wed Nov 01, 2006 4:19 pm    Post subject: Re: TADOQuery and AD multi valued properties Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.