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
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