"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:%23ba8eAQ8JHA.1336@xxxxxx
Quote:
> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
> message news:ee8CVqP8JHA.5400@xxxxxx Quote:
>> The description attribute is a strange one, because technically it is
>> multi-valued, even though there is never more than one value. ADO
>> retrieves it as an string array with one value, or a Null if there is no
>> value assigned.
>
> Sander, to Richard's point, you should probably do an IsArray test before
> using the Join method to prevent an exception in the event that it is
> empty.
>
> sDescription = objRSUserDescr.Fields("description").Value
>
> If IsArray(sDescription) Then
> sDescription = Join(sDescription, Empty)
> Else
> sDescription = Empty
> End If
>
> WScript.Echo sDescription
> Agreed. Another option is to use IsNull, since if this returns False, the
value is an array. I use code similar to:
====
If IsNull(sDescription) Then
sDescription = ""
Else
For Each sItem In sDescription
sDescription = sItem
Next
End If
======
The Join function actually looks cleaner than the For Each loop I use. I
generally the the For Each loop when I deal with other multi-valued
attributes, but in this case the Join is better.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--