Hi,, I'm passing a variable over a URL. The value is user01. The problem is that an error message occurs stating that there is an incorrect column name?! Here is the code below and the error message: <cfquery name="userQuery" datasource="xxxxx" username="xxxxx" password="xxxxx"> SELECT admin FROM users WHERE username="#url.promo#" </cfquery> It comes up with the following error: [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'user01'. Please help. Many thanks in advance,
To answer the question, most drivers require single (not double) quotes ie WHERE username= '#url.promo#' But the proper way is not use quotes at all. Instead use cfqueryparam. It helps performance and w/sql injection. <!--- The cfsqltype should match you db column data type ...---> ie WHERE username= <cfqueryparam value="#url.promo#" cfsqltype="cf_sql_varchar"> Code (markup):