<cfupdate> vs. SQL UPDATE

As with adding data, the choice to use <cfupdate> or SQL UPDATE is yours. The following guidelines as to when to use each option are similar as well:

  • Whenever appropriate, use <cfupdate> to update data.

  • If you find you need to update specific form fields—not all that were submitted—use the <cfupdate> tag with the formfields attribute.

  • If <cfupdate> can’t be used because you need a complex UPDATE statement or you are using fields that aren’t form fields, use SQL UPDATE.

  • If you ever need to update multiple (or all) rows in a table, you must use SQL UPDATE.

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.