Hi,
I'm trying to find an employee in Active Directory using the following c# code:
"Select userPrincipalName, ADsPath, Department, Mail,
HomeMDB, cn, ssn FROM
'LDAP://" + DomainName + "'
WHERE objectCategory = 'person' and
sAMAccountName = '" + UserName.Replace("'", "''") + "'";
When I run this for an employee with a single quote in the last name (such as "O'Connor") I get the following error:
AdsDsoObject' failed with no error message available, result code: DB_E_NOTABLE(0x80040E37).
I also tried Replace("'", "\''"), nothing is working.
What am I doing wrong? need help.
Thank You!