Introducing <cfinsert>

The example in Listing 14.4 demonstrates how to add data to a table using the standard SQL INSERT command. This works very well if you have to provide data for only a few columns, and if those columns are always provided. If the number of columns can vary, using SQL INSERT gets rather complicated.

For example, assume you have two or more data-entry forms for similar data. One might collect a minimal number of fields, whereas another collects a more complete record. How would you create a SQL INSERT statement to handle both sets of data?

You could create two separate templates, with a different SQL INSERT statement in each, but that’s a poor solution. You should always try to avoid having more than one template perform a ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.