Description
Apart from the generic script syntax for the tag, there is another script alternative to cfquery tag, provided by the QueryExecute function. This function simplifies the query execution in the CFScript block.
This function lets you pass unnamed parameters to the query. Use '?' (question mark) as the place-holder for the parameters. The values to the parameters should be passed as an array toparams.
For more information on using the unnamed parameters, see this document.
Note that the following points are applicable:
- If there are any Query parameters, they must be passed as the second argument of the function. It can be either a struct or an array.
- If you need to provide additional attribute as a Query parameter (like CFSQLType, list, and separator), you can pass these as struct against that column name.
- The Query and datasource properties will be passed as the third argument.
The Query tag is also available as a ColdFusion function apart from the generic script syntax for the CFQuery tag. This function simplifies the query execution in the CFScript block.