Openquery and ADSI Problem

G

Guest

I am trying to run a query in an ASP.NET application against Active Directory
using a linked server (ADSI) in SQL Server 2000. The query runs without any
problems in Query Analyzer:

SELECT
sAMAccountName
FROM
OPENQUERY
(
ADSI,
'
SELECT
sAMAccountName
FROM
''LDAP://ADSERVER/ DC=ourdomain,DC=com''
WHERE
MemberOf=''cn=GroupName ,OU=ourOUname,DC=ourdomain,DC=com'' AND
sAMAccountName=''username''
'
);

The query will simply return a username if that user belongs to the
specified group. Once again, this works fine in Query Analyzer, but it does
not return any results in my ASP.NET application. I am using SQLConnection,
SQLCommand, and SQLDataReader objects. I have also tried this with generic
odbc objects, but to no avail.

I have found that the query executes in ASP.NET if I remove the MemberOf
section of the WHERE clause in the query.

Has anyone come across something like this before? Any help would be
appreciated.

Many Thanks,
Jim
 
S

Scott Allen

Sometimes these types of problems (works in XYZ program but not from
ASP.NET) arise because the ASPNET account does not have the same
permissions as the user running XYZ program. Are you connecting to the
database as the ASPNET account?
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top