Sunday, January 15, 2012

Using like in a cfqueryparam

So there I was... attempting to figure out the best way to to a like clause in a query statement using the cfqueryparam tag.



I had it coded like this:




like <cfparam cfsqltype="cf_sql_varchar" value="#arguments.search_criteria#">


Well that didn't work. So I did some googling. After a little bit of searching, I finally found out how it should be coded.




like <cfparam cfsqltype="cf_sql_varchar" value="%#arguments.search_criteria#%">


After laughing at how simple that was... I used it. Worked like a charm.

No comments:

Post a Comment

A Placebo?

 At times I wonder if my medication is just a placebo. That is a medication that usually has no effect on a disease. Am I dreaming it all up...