Solved

Query LDAP using VB6

Posted on 2007-11-14
4
3,717 Views
Last Modified: 2013-12-24
I was given the task to add LDAP functionality in a VB6 app but I have no LDAP experience. I am able to get some of what I'm looking for but not everything. Take a look at the namespace doc supplied to me at http://www.mikkeee.com/misc/namespace.gif.

-com
--corphome
---people
----people
----executives
----union
----international
---pseudo-accounts
----franchisees
----consultants
----vendors

Dim sConn As String
    sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=people/cn=johndoe")
    Set LDAPinfo = GetObject(sConn)
    MsgBox  "Name:" & LDAPinfo.Get("Parrpayname")

The above allows me to get what I want when I'm looking into the people ou but the problem I'm facing is that I also need to search in the vendors ou which is under pseudo-accounts.

sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=pseudo-accounts/ou=people/cn=johndoe")
This does not work.

Any suggestions would be helpful.

Thanks
0
Comment
Question by:Mikkeeee
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 250 total points
ID: 20284874
0
 
LVL 5

Expert Comment

by:23637269
ID: 20780124
I don't know if this will work or not but if MsgBox  LDAPinfo.Get("pseudo-accounts") returns the name of the account you want then.
Dim sPseudoAccount as string
sPseudoAccount = LDAPinfo.Get("pseudo-accounts")

sPseudoAccount should contain "CompanyABC"
You want to build the next string with the value of what sPseudoAccount contains.
That is where the @ comes in.  It tells the computer to use the value that the variable is holding, otherwise you would be using the name of the variable.

sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=" & @sPseudoAccount  & "/ou=people/cn=johndoe")

Hope this helps or at least points you in the right direction, I haven't used LDAP before.

Thanks
Roger
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Optimize/Performance Tune Production Databases 11 63
Remote Server returned '400 4.4.7 Message delayed' 3 173
Do we need servers??? 5 196
Need a replacement data type in Oracle 6 77
I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now