*SOLVED* ColdFusion/SQL Server Issues with URL Parameters

Saint Nick

Lifer
Jan 21, 2005
17,722
6
81
I have a very basic query going against a database of background check information. The parameters are stored in the URL (status of background check, date range, employee ID, user ID who did the background check). I am adding the feature to export the data to Excel. When I click on "To Excel" on my form, the following happens:

Error Executing Database Query.

[Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'vsec082'. The error occurred in /content/employees/htdocs/emp/operating/she/safety/publicsafety/secure/dvms/backgrd_ckXL.cfm: line 82
Code:
80 :                 <!---User ID pulled from form--->
81 :                 <cfif isdefined("UserID") AND UserID NEQ ''>
[B]82 :                     AND AssignedTo = #UserID#[/B]
83 :                 </cfif>
84 :
What I want to know is...why does SQL Server think the data value I am inputting is a column name. AssignedTo isn't another variable used in the page that creates the Excel spread sheet...so I'm not sure what is going on.
 
Last edited:

Train

Lifer
Jun 22, 2000
13,583
80
91
www.bing.com
Code:
80 :                 <!---User ID pulled from form--->
81 :                 <cfif isdefined("UserID") AND UserID NEQ ''>
[B]82 :                     AND AssignedTo = '#UserID#'[/B]
83 :                 </cfif>
84 :

Wrap it in quotes brotha.
 

Saint Nick

Lifer
Jan 21, 2005
17,722
6
81
Yeah...after going over it for about 45 minutes, I finally figured it out. Thanks Train!

Massive forehead slap.