[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

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
0
Ponthecomputer
Asked:
Ponthecomputer
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
dim samvariable
samvariable = "johnD"

"SELECT mail FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='user' " & _
        "AND sAMAccountName='" & samvariable & "'"

0
 
PonthecomputerAuthor Commented:
Thanks angelIII
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now