Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP in VB not working right.

Status
Not open for further replies.

rbgCODE

Programmer
Aug 17, 2005
3
US
Let me start by saying I am not trying to query AD, but a cisco call manager, which should still use regular LDAP.

It took me a long time to finally connect, but my problem is if I specify any field name, it gives me an unspecified error, if I select * then it only returns one field, the cn field.

Can someone please enlighten me. Below is my code.

Set oConn = New ADODB.Connection
oConn.Provider = "ADSDSOOBject"
oQuery = "Select * From 'LDAP://" & i.l_server & "'"
oConn.Provider = "ADsDSOObject"
oConn.Properties("User ID") = i.l_user
oConn.Properties("Password") = i.l_pass
oConn.Properties("Encrypt Password") = True
oConn.Open "DS Query", i.l_user, i.l_pass
Err.Clear
Set rs = oConn.Execute(oQuery)
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, Err.Number
Else
xRid i.txt_File
End If
While Not rs.EOF
If Trim(rs.Fields("sn").Value) <> "" And Trim(rs.Fields("telephonenumber")) <> "" Then mt Trim(rs.Fields("sn").Value) & ", " & Trim(rs.Fields("givenname").Value) & ", " & Trim(rs.Fields("telephonenumber")) & ", ", i.txt_File
rs.MoveNext
Wend
Unload Me
End
Exit Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top