ADS Related Query

  • Thread starter Thread starter Arvind P Rangan
  • Start date Start date
A

Arvind P Rangan

Hi,

I like to know if there is any way we can use SQL Query syntax for
getting values out of ADS.

If there is any method pls let me know with example.

Thanks
Regards
ARvind Rangan
 
Hi Arvind

You can query ADS using the Active Directory Provider

example is below - note that I haven't tested this

Cheers

Jody

Dim cn As OleDb.OleDbConnection = New
OleDb.OleDbConnection("Provider=ADsDSOObject")
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand
Dim dr As OleDb.OleDbDataReader


Dim sADsDomain As String
sADsDomain = "mydomain"

cmd.CommandText = "SELECT distinguishedName FROM 'LDAP://" &
sADsDomain

cmd.Connection = cn
cn.Open()

Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter

da.SelectCommand = cmd
Dim ds As DataSet
da.Fill(ds)
 
Back
Top