Yes, the spaces will make a significant difference.

<cfset user = Trim(Session.username) & "@"> 
<cfquery name="getUser" datasource="myDSN">
select email
from client
where email like <cfqueryparam value="#user#%" cfsqltype="CF_SQL_VARCHAR">
</cfquery>

That should eliminate the spaces and also provide a little more security on
the DB access. I don't think there is a difference between Access and SQL
Server in that regard. It does appear to me as if your session variable has
a space in front and in back of the actual value. The Trim() will eliminate
those spaces.

Ray Thompson
Tau Beta Pi (www.tbp.org) 
The Engineering Honor Society 
865-546-4578


-----Original Message-----
From: Adam Parker [mailto:adgpa...@iupui.edu] 
Sent: March 20, 2009 02:28 PM
To: sql
Subject: Re: Get Username from email address


Hi Ray - 

I've tried this and modified the query to get just the email field and
compare the username to the email field.  I don't see why it's not working:

<cfset user = Session.username & "@"> 


<cfquery name="getUser" datasource="myDSN">
select email from client where email like '#user#%'
</cfquery>

<cfdump var="#getUser#">

CFDump produces:

select email from client where email like ' adgparke @*' 

Does the space between the username and the "@" make a difference?  Does it
make a difference that this is an Access database?  I don't get why it's not
working.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/sql/message.cfm/messageid:3208
Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6

Reply via email to