Link to home
Start Free TrialLog in
Avatar of Ponthecomputer
Ponthecomputer

asked on

Using a variable in a SELECT statement when querying LDAP - VBScript

I need to query LDAP using a variable as part of the select statement. This syntax won't work. Is is possible to do this and if so, how can I correct this so that it will work? Thanks!

dim samvariable
samvariable = johnD

"SELECT mail FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='user' " & _
        "AND sAMAccountName=" & samvariable
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ponthecomputer
Ponthecomputer

ASKER

Thanks angelIII