Questions tagged [cfqueryparam]

`` is a ColdFusion tag that is used to parameterize values that are used in the ``

Some of the benefits to using the <cfqueryparam> tag include:

  • All special characters are escaped
  • Protection against SQL injection attacks.
  • While ColdFusion is not strongly typed, SQL is. The CFSQLTYPE attribute converts the ColdFusion variables to the proper SQL type
  • NULLs can be handled separately from blank strings
  • ColdFusion lists can be converted for use in SQL Select IN statements
  • SQL can make better use of query plans

For more details

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-p-q/cfqueryparam.html

For cfscript equivalent

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-m-r/queryexecute.html

Also see

65 questions
1
vote
2 answers

Passed value being treated as empty in CFQUERYPARAM

This is baffling me greatly as I have done this a hundred times, but now it fails me. I am doing a basic query update using CF params, and the primary key for the table is passing an empty value in, resulting in a critical failure. Even if I enter…
justacoder
  • 2,684
  • 6
  • 47
  • 78
1
vote
1 answer

Coldfusion8 Parameter index out of range error

I'm doing something stupid, but I don't know what it is, can someone point out to me why I am getting this error: Parameter index out of range (1 > number of parameters, which is 0). From this code, This form:
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
1
vote
1 answer

cfqueryparam pass in list from input checkbox

I have a input checkbox field where user can select multiple checkboxes in a form, and depending on what they select, it will create a string of id's like 10,14,35,47, and that will be submitted to the database. I can get this submitted if I just…
Joel
  • 41
  • 1
  • 5
1
vote
2 answers

Coldfusion: executing dynamic query containing cfqueryparam

First, the code. I'm making a struct of queries:
Binod Kalathil
  • 1,939
  • 1
  • 30
  • 43
1
vote
1 answer

Struckt Key Exists in cfqueryparam?

I have form fields with checkbox fields. On my cfc page I would like to use strucktKeyExists to check if checkbox form fields exist when I run my Insert/Update query. Also I have null attribute in my cfqueryparam that will set value to true/false if…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
1
vote
2 answers

Getting a single output from cfquery when query column is cfqueryparam variable

I'm using ColdFusion and trying to make a function that will allow me to get the value of a specific column in a specific account (each account is its own record/row). A function like this works fine:
Ectropy
  • 1,533
  • 4
  • 20
  • 37
1
vote
2 answers

Trouble using cfqueryparam with sql query strings

So I have a string that was constructed in a different file being passed into a query as a global variable that I need to bind (legacy code): SELECT * FROM…
ConorBaumgart
  • 493
  • 1
  • 3
  • 18
1
vote
1 answer

PreserveSingleQuotes and CFQueryParam

I am building a dynamic SQL Query using CFLoop. I am using CFSaveContentto iterate through the variables and build the query and then I am executing it in CFQuery using PreserveSingleQuotes. That works fine but the issue with this method is that I…
BlackM
  • 3,927
  • 8
  • 39
  • 69
1
vote
3 answers

Compare DateTime values by Min and not by Day in Coldfusion CFQUERY

This is the query that I have. UPDATE ticketlist SET status = WHERE expdatetime <
Nich
  • 283
  • 2
  • 12
1
vote
1 answer

How to use the cfqueryparam for a null value to get records from a table?

Can i use the cfqueryparam for a null value to get records from a table? My sample select Query is Select * from users where lastname is null Dan Bracuk's edit starts here Here is a sample query against an oracle database:
Sathish Chelladurai
  • 670
  • 1
  • 8
  • 23
1
vote
0 answers

How can I include query parameters passed to SQL Server in the query text as comments?

Since you can't get the values of parameters of running queries in SQL Server I was thinking of appending the parameter values to the query in the form of comments that would then be visible via sp_who2. For example If I have this query: SELECT…
1
vote
1 answer

Coldfusion MYSQL Date Query Parameter not returning results

I've just come across what I think must be a coldfusion bug. I have a query: SELECT * FROM MyLovelyTable WHERE 1=1 AND phoneNumber =
Rumpleteaser
  • 4,142
  • 6
  • 39
  • 52
1
vote
1 answer

Select IN on more than 2100 values

How can you do a select in on more than 2100 values? SELECT sub_acct_no, ... FROM dbo.Closed_ORDER WHERE ord_no IN
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
1
vote
2 answers

ColdFusion 9: int and type="numeric" nasty bug?

I've just experienced a behaviour that defies any logic and could potentially lead to serious issues and was wondering if it was a bug or if the behaviour was itended and what are the best practices to circumvent the issue? If it's a bug, is there a…
plalx
  • 42,889
  • 6
  • 74
  • 90
1
vote
1 answer

CFQUERYPARAM breaking with "+" in URL

I have a query: SELECT id FROM table WHERE field1= AND field2= AND field3=
Pete
  • 4,542
  • 9
  • 43
  • 76