• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting a variable to query cfldap

Community Beginner ,
Nov 21, 2007 Nov 21, 2007

Copy link to clipboard

Copied

I'm having difficulties querying cfldap - I hope someone can help. I have the following code

<cfldap action="query"
name="getaccount"
start="ou=Live,ou=User Accounts,DC=internal,DC=westminster,DC=gov,DC=uk" maxrows="10"
attributes="cn,sAMAccountName"
filter="sAMAccountName=#user#"
server="xx.xx.xx.xx"
username="INTERNAL\username"
password="password">

I firstly get the variable "#user#" from the user's userid like this:

<cfset domain = ListGetAt(get_userid.userid, "1", "\,/")>
<cfset user = ListGetAt(get_userid.userid, "2", "\,/")>

and then insert it into the cfldap query. Thing is it doesn't work - doesn't error or anything. However, if I was to go:

<cfset user = "xxxxx"> where xxxxx is the actual userid of the user it works fine. Have tried using cfparam and got nothing but beyond this I have run out of ideas. Anyone help would be appreciated.

Thanks from the UK
TOPICS
Advanced techniques

Views

300

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Nov 30, 2007 Nov 30, 2007
Probably such a simple solution everybody deigned it below them. Should have stuck it in the "Getting started" forum. Anyway the answer was that my variable was recorded as a char in the sql database - simply changing it to nvarchar gave me the results I was after.

Votes

Translate

Translate
Community Beginner ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

I know it's only one day but I'm a bit disappointed with the response - surely someone out there has come across this before? In case there's any misunderstanding

get_userid.userid is "domainname\userid".

If anybody has an idea and they need more info let me know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2007 Nov 30, 2007

Copy link to clipboard

Copied

LATEST
Probably such a simple solution everybody deigned it below them. Should have stuck it in the "Getting started" forum. Anyway the answer was that my variable was recorded as a char in the sql database - simply changing it to nvarchar gave me the results I was after.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation