操作系统之间的 LDAP 连接差异

发布于 2025-01-05 03:46:40 字数 1370 浏览 0 评论 0原文

我有在两个不同系统上执行 LDAP 查询的相同方法。该方法非常简单:

Public Function AutenticaDominio(ByVal user As String, ByVal ambiente As String) As String


    Dim Comm As New ADODB.Command
    Dim conn As New ADODB.connection

    Dim rs As New ADODB.Recordset
    Dim codiceBanca As String

    Dim currentAmbiente As String
    Dim currentName As String
    Dim trovato As Boolean
    Dim UserName As String

    Set conn = CreateObject("ADODB.Connection")
    conn.Provider = "ADsDSOObject"
    conn.Properties("User ID") = "XXX"
    conn.Properties("Password") = "XXX"
    conn.Open "DS Query", "XXX", "XXX"
    Set Comm = CreateObject("ADODB.Command")
    Set Comm.ActiveConnection = conn
    Comm.CommandText = "SELECT SBAcodicebanca FROM 'LDAP://abc.cde.fgh.it/ou=bank,dc=cde,dc=it' WHERE uid = '" & user & "' and SBAelencoambienti = 'sbacodicesottoambiente=GEST,sbacodiceambiente=PROT,ou=applicazioni,dc=cde,dc=it'"
    rs.CursorLocation = adUseClient
    Set rs = Comm.Execute

    If rs.EOF = False Then
       If rs.Fields.Item(0) = "099" Then
          Autentica = rs.Fields.Item(0)
          Exit Function
       Else
               Autentica = ""
       End If
    Else
        Autentica = ""
    End If

End Function

rs.execute 语句,在 Windows XP 上运行该方法时返回“未指定错误”。该方法在 Windows 7 上运行良好。

该项目是相同的,具有相同的参考和组件。

有谁知道哪里可能出现错误?

i have the same method that performs an LDAP query on two different system. The method is very simple:

Public Function AutenticaDominio(ByVal user As String, ByVal ambiente As String) As String


    Dim Comm As New ADODB.Command
    Dim conn As New ADODB.connection

    Dim rs As New ADODB.Recordset
    Dim codiceBanca As String

    Dim currentAmbiente As String
    Dim currentName As String
    Dim trovato As Boolean
    Dim UserName As String

    Set conn = CreateObject("ADODB.Connection")
    conn.Provider = "ADsDSOObject"
    conn.Properties("User ID") = "XXX"
    conn.Properties("Password") = "XXX"
    conn.Open "DS Query", "XXX", "XXX"
    Set Comm = CreateObject("ADODB.Command")
    Set Comm.ActiveConnection = conn
    Comm.CommandText = "SELECT SBAcodicebanca FROM 'LDAP://abc.cde.fgh.it/ou=bank,dc=cde,dc=it' WHERE uid = '" & user & "' and SBAelencoambienti = 'sbacodicesottoambiente=GEST,sbacodiceambiente=PROT,ou=applicazioni,dc=cde,dc=it'"
    rs.CursorLocation = adUseClient
    Set rs = Comm.Execute

    If rs.EOF = False Then
       If rs.Fields.Item(0) = "099" Then
          Autentica = rs.Fields.Item(0)
          Exit Function
       Else
               Autentica = ""
       End If
    Else
        Autentica = ""
    End If

End Function

The rs.execute statement, return an "unspecified error" where i run the method on a windows XP. The method works well on Windows 7 instead.

The project is the same, with the same references and components.

Does anyone know where could be the error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文