September 2007
Intermediate to advanced
600 pages
20h 21m
English
You’ve used lots of <cfquery> tags thus far, and each of them has contained hard-coded SQL—SQL that you typed and that stays the same (the results may differ if the data in the database changes, but the SQL itself always stays the same). But SQL passed to ColdFusion need not be static and hard-coded; the real power of <cfquery> is seen when SQL is constructed dynamically.
To demonstrate what we mean, Listing 10.11 contains the code for a new file named dynamicsql.cfm. Save the code and execute it to see a screen like the one shown in Figure 10.13.
<!--- Name: dynamicsql.cfm Author: Ben Forta (ben@forta.com) Description: Dynamic SQL demonstration Created: 07/01/07 ... |
Read now
Unlock full access