VBscript gurus...

Discussion in 'OT Technology' started by ShapeShifterz, Feb 3, 2005.

  1. ShapeShifterz

    ShapeShifterz Longtime Lurker

    Joined:
    Mar 15, 2000
    Messages:
    183
    Likes Received:
    0
    Location:
    Bay Area, CA
    I work mainly in a unix environment so I'd appreciate some vbscripting help. I'm basically trying to sort a record set that is created from an ldap search before its formatted into HTML. I found a .Sort method but its expecting a String value?!? Here's an exerpt where the sorting needs to take place:

    Code:
    Set objCOmmand.ActiveConnection = objConnection
    objCommand.CommandText = _
        "Select displayName,mail from 'LDAP://OU=Distribution Lists,DC=domain,DC=com' " _
            & "Where objectClass='group'"  
    Set objRecordSet = objCommand.Execute
    //Sort HERE???
    objRecordSet.MoveFirst
    
        Response.Write ("<TABLE>")
    Do Until objRecordSet.EOF
        Response.Write ("<TR><TD><FONT class=main><A HREF=distlists.asp?flag=1&addy=" & objRecordSet.Fields("mail").Value & ">" & objRecordSet.Fields("displayName").Value & "</A></FONT></TD>")
        Response.Write ("<TD><FONT class=main>" & objRecordSet.Fields("mail").Value & "</FONT></TD></TR>")
        objRecordSet.MoveNext
    Loop
    
    TIA
     
  2. EvilSS

    EvilSS New Member

    Joined:
    Jun 11, 2003
    Messages:
    5,104
    Likes Received:
    0
    Location:
    STL
    I've never tried it with LDAP, but can you modify the query to include ORDER BY? It is essentially a SQL language query. For example:

    "Select displayName,mail from 'LDAP://OU=Distribution Lists,DC=domain,DC=com' " _
    & "Where objectClass='group' ORDER BY displayName"

    Syntax is here: http://www.w3schools.com/sql/sql_orderby.asp
     

Share This Page