home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / ADSDK.ZIP / Samples / Start / Search / vb / Search.bas next >
Encoding:
BASIC Source File  |  1999-01-19  |  791 b   |  30 lines

  1. Attribute VB_Name = "Module1"
  2. Sub Main()
  3.  
  4.     Dim con As New Connection, rs As New Recordset
  5.     Dim Com As New Command
  6.      
  7.     
  8.     'Open a Connection object
  9.     con.Provider = "ADsDSOObject"
  10.     con.Open "Active Directory Provider"
  11.     
  12.     ' Create a command object on this connection
  13.     Set Com.ActiveConnection = con
  14.     Com.CommandText = "select name from 'LDAP://DC=windows2000,DC=nttest,DC=microsoft,DC=com' where objectCategory='group' ORDER BY NAME"
  15.     
  16.     Set rs = Com.Execute
  17.         
  18.     
  19.     '--------------------------------------
  20.     ' Navigate the record set
  21.     '----------------------------------------
  22.     While Not rs.EOF
  23.        'For Single Value attribute
  24.        Debug.Print rs.Fields("Name")
  25.        rs.MoveNext
  26.     Wend
  27.     
  28.  
  29. End Sub
  30.