Creating an Update Page with CFUPDATE  
 
 

The CFUPDATE tag is the easiest way to handle simple updates from a front end form. The CFUPDATE tag has an almost identical syntax to the CFINSERT tag.

To use CFUPDATE, you must include all of the fields that comprise the primary key in your form submittal. The CFUPDATE tag automatically detects the primary key fields in the table you are updating and seeks them out in the submitted form fields. ColdFusion uses the primary key field(s) to select the record to update. It then updates the appropriate fields in the record using the remaining form fields submitted.

 
 
  Example: CFUPDATE page  
 

The ODBC data source is named "Employee DB," and the table you want to update is named "Employees." With the form example just described as the front end, the CFUPDATE tag would be included in your page as follows:

<CFINSERT DATASOURCE="Employee DB" 
    TABLENAME="Employees">

<!--- This is the page EmployeeUpdate.cfm --->
<CFUPDATE DATASOURCE="Employee DB" 
    TABLENAME="Employees">

<HTML>
<HEAD>
    <TITLE>Reply</TITLE>
</HEAD>
<BODY>

<H2>Thank You!</H2>
<HR>
<P>Thank you for updating your data in 
our database - please visit our site often!</P>
<HR>

</BODY>
</HTML>


 
 
BackUp LevelNext
 
 

allaire     AllaireDoc@allaire.com
    Copyright © 1998, Allaire Corporation. All rights reserved.