Link to home
Create AccountLog in
Avatar of danawebas
danawebas

asked on

Problems with a update statement in AD

Hello
I have a bit of a problem with LDAP - I tried google, but without luck. It's no problem to get information, but when i try to update it's getting tricky.

When i use this home made solution i get a error:

strSQL = "UPDATE 'LDAP://OU=Denmark,OU=oudomain,DC=do,DC=domain,DC=local' SET name = 'New Name' WHERE sAMAccountName = 'user' "

Error:
Provider error '80040e14'
One or more errors occurred during processing of command.
/from/updatesql.asp, line 13 ( Conn.Execute(strSQL) )

When i use this method, it works, but i want to connect with username and NOT commonname, it will cause troubles if there are two users with same name:

Set objUser = GetObject("LDAP://cn=Some Name,OU=Denmark,OU=oudomain,DC=do,DC=domain,DC=local")
objUser.cn = strName
objUser.SetInfo

Im coding in ASP.

Hope there someone who can help me...
SOLUTION
Avatar of exx1976
exx1976
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.