ADO.NET and Active Directory

  • Thread starter Thread starter Mario Rodriguez
  • Start date Start date
M

Mario Rodriguez

Hi people, there is a way to make searches on active directory thru
ADO.NET?, so the result is an DataSet object and not a DirectoryENtry object

thanks
 
¤ Hi people, there is a way to make searches on active directory thru
¤ ADO.NET?, so the result is an DataSet object and not a DirectoryENtry object
¤

You can use the native .NET OLEDB library with the ADsDSOObject provider

Function QueryActiveDirectory() As Boolean

Dim ADConnection As New System.Data.OleDb.OleDbConnection("Provider=ADsDSOObject;")

ADConnection.Open()
Dim da As New System.Data.OleDb.OleDbDataAdapter("select name, ADsPath from
'LDAP://DC=xxx,DC=xxx,DC=org' WHERE objectCategory='organizationalUnit' or objectCategory='group'",
ADConnection)

Dim ds As New DataSet

da.Fill(ds, "ADResults")

frmMain.DataGrid1.SetDataBinding(ds, "ADResults")

ADConnection.Close()

End Function


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Hi people, there is a way to make searches on active directory thru
ADO.NET?, so the result is an DataSet object and not a DirectoryENtry object

No, not out of the box. Also, in .NET, you can easily use the
DirectorySearcher class, which is quite easy and nice to use, really
(compared to the olden days of IDirectorySearch......)

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
DirectorySearcher returns an DirectoryEntry Collection or a DataSet ???
 
DirectorySearcher returns an DirectoryEntry Collection or a DataSet ???

It returns a DirectoryEntry on the .FindOne(), or a
SearchResultCollection in the .FindAll() methods. In both cases,
definitely *NOT* a data set.

MArc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
¤ >Hi people, there is a way to make searches on active directory thru
¤ >ADO.NET?, so the result is an DataSet object and not a DirectoryENtry object
¤
¤ No, not out of the box. Also, in .NET, you can easily use the
¤ DirectorySearcher class, which is quite easy and nice to use, really
¤ (compared to the olden days of IDirectorySearch......)

Well, actually you most certainly can query AD via ADO.NET (see the example in my post). The
ADsDSOObject provider is available to ADO.NET via the native .NET OLEDB library just as it was for
ADO and OLEDB.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top