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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP through VB

Status
Not open for further replies.

pixaar

Programmer
Jul 19, 2006
3
FI
hello..
I am new to VB and really new to LDAP

I am trying to write an application for our lunch card system...where a student's card is read by a barcode reader and the information (a string) is sent to the LDAP and some attribute value is accessed.

here's the BaseDN:- ou=test1,dc=ky,dc=local
LDAP server:- ldapone.ky.local

I have the userDN and Password!...
I would like to know the syntax for bindin and R/W to a specific attribute!...... i tried to make the connection using the following but it's not working!..

Dim con
Dim command
Dim rs
Dim dso
Dim cont
Dim path
Dim user

AdsPath = "LDAP://ldapone.ky.local/ou=Students,ou=test1,dc=ky,dc=local"
Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Properties("User ID") = "uid=test2admin,ou=adminuser,dc=ky,dc=local"
con.Properties("Password") = "password"
con.Properties("ADSI Flag") = "34"

con.Open "ADSI"

Set com = CreateObject("ADODB.Command")
Set com.ActiveConnection = con




com.CommandText = "<" & LDAP: /ldapone.ky.local/ou=Students,ou=test1,dc=ky,dc=local & ">;(uid="& kt40627 & " );Adspath,cn,SavoniaStudentCard,SavoniaLastLunch;s
ubtree"



Set rs = com.Execute


may i get some help working things out here?
thank you very much!
 
[1] >con.Properties("ADSI Flag") = "34"
Change and set it to a number 34. But you still need server_binding 512. Hence try this.
[tt]con.Properties("ADSI Flag") = 546[/tt]

[2] Also add password encrytion property at will.
[tt]con.Properties("Encrypt Password")=true[/tt]
 
tsuji,

i tried it ....still no!
i an new to this LDAP.i want to know if i am doing it correctly!
if not,can you suggest some alternative to connect and bind to a server using the BaseDN and UserDN...?

 
>com.CommandText = "<" & LDAP:[highlight] /[/highlight]ldapone.ky.local/ou=Students,ou=test1,dc=ky,dc=local & ">;(uid="& kt40627 & " );Adspath,cn,SavoniaStudentCard,SavoniaLastLunch;s
ubtree"


[1] Don't know whether the line breaks are real or just cut-and-past. There should not be line-break in that form.
[2] subtree should not be broken up into two lines.
[3] LDAP: must be followed by double slash. (there is only one above.)
 
hi again

i have tried to make the syntax right and still there seem to be some problem!

the syntax is okay now.....there are no line breaks!

is there any other way of simply binding?
i checked out the MSDN pages for LDAP bind!...
but i fail to understand the syntax as i am quite new to LDAP!
please reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top