Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems getting info from Active Directory

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
I have ran the add linked server stored procedure and it works fine, but when I run this code...

Code:
IF NOT EXISTS    (SELECT    srvname FROM master..sysservers WHERE srvname = 'ADSI')
BEGIN
    EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADSDSOObject', 'adsdatasource'
END

DECLARE    @SQL_STMT as nvarchar(300)
DECLARE @LOGIN_NAME as varchar(30)

SET     @LOGIN_NAME = 'lcjohnson'


SET     @SQL_STMT =     'SELECT [name] as ' + CHAR(39) + 'AD_Login' + CHAR(39) + ',' +
            ' UPPER([displayname]) as ' + CHAR(39) + 'AD_Display_Name' + CHAR(39) + 
            ' FROM OpenQuery(ADSI, ' + CHAR(39) + ' SELECT name, displayname ' +
            ' FROM ' + CHAR(39) + CHAR(39) + 'LDAP://DOMAIN.ca/OU=Accounts,DC=DOMAIN,DC=ca' +
            CHAR(39) + CHAR(39) + ' WHERE name = ' + CHAR(39) + CHAR(39) + @LOGIN_NAME  +
            CHAR(39) + CHAR(39) + CHAR(39) + ')'
PRINT @SQL_STMT
EXEC sp_executesql     @SQL_STMT

I get this message...


An error occurred while preparing a query for execution against OLE DB provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::prepare returned 0x80040e14].


Thanks in advance for your help!


ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
DANG! ... quick search of Microsoft.com for 0x80040E14 returns 135 hits ... dumb question, but have you sifted through the 135 hits?
 
Yes. The majority of them say it is one or two things. Security or syntax. I belive it is security.

Thanks.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top