LDAP Query Trouble

Results 1 to 2 of 2

Thread: LDAP Query Trouble

  1. #1
    Join Date
    Dec 1969

    Default LDAP Query Trouble

    I have written a script to query an LDAP The script is <BR><BR>****************************************** ****************<BR>&#060;%<BR>SQLStmt = "SELECT sn,mail " & _<BR> "FROM &#039;LDAP://; " & _<BR> "WHERE objectClass=&#039;*&#039;"<BR><BR>Set Conn = CreateObject("ADODB.Connection")<BR>Conn.Provider = "ADSDSOObject"<BR><BR>Conn.Open "ADs Provider"<BR>Set rs = Conn.Execute(SQLStmt)<BR>%&#062;<BR>&#060;body&#06 2;<BR><BR><BR>&#060;%<BR>Do While Not rs.EOF Or rs.BOF<BR> ReturnValue = rs.Fields(0)<BR> If IsArray(ReturnValue) Then<BR> For I = LBound(ReturnValue) To UBound(ReturnValue)<BR> If ReturnValue(I) &#060;&#062; "" Then<BR> Response.Write ReturnValue(I) & "<BR>"<BR> End If<BR> Next<BR> Else<BR> Response.Write ReturnValue & "<BR>"<BR> End If<BR> rs.MoveNext<BR>Loop<BR><BR>%&#062;<BR>&#060;/body&#062;<BR><BR>******************************** *******************<BR>The script runs without error Except, In my strSQL string<BR>I am requesting sn,givenname,mail<BR><BR>My output only displays the mail field. I have played<BR>around with nesting the for next but have been unsuccesful.<BR>Any help would be greatly appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: LDAP Query Trouble

    This is obviously over a year later but the answer might help others. You&#039;re only receiving the first field because you&#039;re only asking for the first field - ReturnValue = rs.Fields(0). You need to set up either an iteration to obtain the other field values rs.Fields(1),rs.Fields(2), etc. or create additional If statements to capture the other fields.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts