zoukankan      html  css  js  c++  java
  • LS函数:在AD中,查询指定用户条目

    01 Function SearchAD(userName As String) As String  
    02    Dim objConnection As Variant  
    03    Dim objCommand As Variant  
    04    Dim objRecordSet As Variant  
    05    Const ADS_SCOPE_SUBTREE = 2
    06 
    07    On Error Goto errHandler    
    08    Set objConnection = CreateObject("ADODB.Connection")
    09    Set objCommand = CreateObject("ADODB.Command")
    10    objConnection.Provider = "ADsDSOObject"
    11    objConnection.Open "Active Directory Provider"
    12    Set objCommand.ActiveConnection = objConnection
    13    objCommand.Properties("Page Size") = 1000
    14    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
    15    ' Note: 使用ADS中属性查询
    16    ' 查询语句,相关语句可查询MSDN中相关对象
    17    objCommand.CommandText = "SELECT * FROM 'http://www.cnblogs.com/hannover/admin/ldap://10.1.1.8/' WHERE cn='"+userName+"' "  
    18 
    19    Set objRecordSet = objCommand.Execute      
    20    If ( objRecordSet.RecordCount = 0 ) Then
    21        SearchLDAP="0"
    22    Else
    23        SearchLDAP="1"
    24    End If
    25    objRecordSet.close
    26 
    27    Exit Function
    28errHandler:
    29    Msgbox "Error is : " & Error$ & " at line number : " & Cstr(Erl) & " in SearchAD() " & " while processing user : " & userName
    30    Exit Function
    31End Function
  • 相关阅读:
    oracle 17068
    Nginx
    B/S端开发工具DevExtreme Angular控件
    UI组件库Kendo UI for Angular入门指南教程
    DevExpress WinForms v21.1
    WPF应用界面开发入门教程
    界面控件Telerik UI for WinForm初级教程
    十六、内联style.html
    十五、css样式class的多种用法
    十四、系统修饰键
  • 原文地址:https://www.cnblogs.com/hannover/p/2061998.html
Copyright © 2011-2022 走看看