2015-01-16 15 views
0

특정 사용자를 ADAM으로 검색하는 방법이 있습니다.검색 방법 단일 사용자 LADP에서 :

'set up the LDAP entry object 
     objEntry = New DirectoryEntry("LDAP://" & m_strLDAPServer & ":" & m_strLDAPPort & "/" & m_strLDAPEntry) 
is the default but it must be set explicitly so that the props array can be passed in 
     objSearcher = New DirectorySearcher(objChild, "(objectClass=*)", strProps) 
     objSearcher.SearchScope = SearchScope.Base 

objSearcher = New DirectorySearcher(objChild, "(objectClass=*)", strProps) 
     objSearcher.SearchScope = SearchScope.Base 
     'carry out the search 
     Try 
      objResult = objSearcher.FindOne() 
     Catch 
      objResult = Nothing 
     End Try 

나는 ADAM에서 SQL을 결과를 얻으려면 : '%의 strUserName %의'처럼,하지만 난 단지 전체 문자열 "strUserName"를 검색 유일한 방법 FindOne()을 발견,하지만 수행하지 SQL Like Operation. 모든 아이디어 SQL LIKE처럼 검색하려면 어떻게해야합니까?

답변

0

그 잘 작동 : 여기

eobjEntry = New DirectoryEntry("LDAP://" & m_strLDAPServer & ":" & m_strLDAPPort & "/" & "cn=" & txtUserName & "," & m_strLDAPEntry) 
    'set the user name and password, if necessary 

    Dim search As New DirectorySearcher() 

'검색 & txtUserName &는 SQL처럼 작동 작동 objSearcher = 새 DirectorySearcher (objEntry, "(CN ="& txtUserName & ")") objSearcher.SearchScope = SearchScope.Base 및 SearchScope.OneLevel Dim result as SearchResult = search.FindOne()

+0

SQL 'LIKE'작업과 유사합니다. –