Issue in working with Query using vb2005 and .Net 2.0

Asked By 30 points N/A Posted on -
qa-featured

Hi experts.

When I want to get my query to work, I use vb2005 and .Net 2.0. I posted my problem on several forums but could not find any assistance. I want to query Active Directory from the code behind but I encounter the following issues:

1. I need to select only where "title" is empty and
2. I need to do a LIKE on sAMAccountName

Tried several step but always facing error:

Error:

System.Data.OleDb.OleDbException: 'ADSDSOObject' failed with no error message available, result code: DB_E_ERRORSINCOMMAND(0x80040E14).

But if I ignore the "title" and the "sAMAccountName" the query works fine. So I really need a solution from anyone.

Thanks.

SHARE
Answered By 5 points N/A #90261

Issue in working with Query using vb2005 and .Net 2.0

qa-featured
Hi , Myrna try to change the original stored procedure call as given below..:
  • The LDAP query in which the application present instead of the database server , By the SQL Server using as a proxy in getting an Active Directory adds an the additional layer of confusion as it might make the debugging more difficult and hence it may be required for you in creation of a linked server.
  • Simply change the original stored procedure call to:
Dim con As New OleDb.OleDbConnection("Provider=ADSDSOObject")
Dim cmnd As OleDb.OleDbCommand = con.CreateCommand()
cmnd.CommandText = "select sAMAccountName from 'LDAP://DC=Velliogroup,DC=COM' where objectCategory = 'User'"
 
Dim da As New OleDb.OleDbDataAdapter(cmnd)
da.Fill(mySqlDataTable)
Session("myMenuDataTable") = mySqlDataTable
  • And also do the change in this and check your syntax once..
select sAMAccountName from 'LDAP://DC=Velliogroup,DC=COM' where objectCategory = 'User'
 
where title is not Null and (userAccountControl <> '56050' and userAccountControl <> '214')
 
Thank you..:-)

Related Questions