如何从 LADP 搜索单个用户:

How to search Single user From LADP:

我有一种方法可以将特定用户搜索到 ADAM 中。

 '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%',但我发现只有方法 FindOne() 只搜索完整的字符串 "strUserName",但它不执行 SQL Like 操作。 任何想法 我怎样才能搜索 SQL LIKE?

它工作正常:

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 = New DirectorySearcher(objEntry, "(cn=" & txtUserName & ")") objSearcher.SearchScope = SearchScope.Base 和 SearchScope.OneLevel 昏暗的结果 As SearchResult = search.FindOne()