LDAP Query Failure due to single quote -


I am trying to find an employee in Active Directory using the following C # code:

< Pre> "UserPriner Name, ADSpath, Department, Mail, HomeMDB, CN, SSN FARDADLDPAP: //" + Domain Name + "'Object Category =' Inger 'and SAM ACCnetName ='" + Username. When I went with a single coat in the last name for an employee (like "o 'connor"), "Replay" ("", "' ') +"' ";

I get the following error:

AdsDsoObject 'no error message was available, result code: DB_E_NOTABLE (0x80040E37).

  I too tried to change ("'", "\'" "), nothing worked.  

What am I doing wrong?

It should be replaced on its line

  username Change ("", "\ '"); "Userpreneurname, adpath, department, mail, homemdb, cn, ssn foddadlidap: //" + domain name + "'object Caribbean =' person 'and' smaccountnam = '" + username "" "";  

Comments