<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFUPDATE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFUPDATE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Updates records in a data source from data in a ColdFusion form or form Scope.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
Database manipulation tags
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">Syntax</span><pre>&lt;cfupdate 
   dataSource = &quot;ds_name&quot;
   tableName = &quot;table_name&quot;
   tableOwner = &quot;name&quot;
   tableQualifier = &quot;qualifier&quot;
   username = &quot;username&quot;
   password = &quot;password&quot;
   formFields = &quot;field_names&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
cfinsert, cfprocparam, cfprocresult, cfquery, cfqueryparam, cfstoredproc, cftransaction; "Creating an update action page with cfupdate" in Chapter&#160;21, "Updating Your Database," in ColdFusion MX Developer's Guide
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">History</span>
<p>
ColdFusion&#160;MX: Deprecated the connectString, dbName, dbServer, dbtype, provider, and providerDSN attributes. They do not work, and might cause an error, in releases later than ColdFusion 5. 
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;!--- This example allows you to update a person&#39;s telephone number in the 
employee table. ---&gt;
&lt;cfif isDefined(&quot;form.phone&quot;)&gt;
   &lt;cfupdate datasource=&quot;cfdocexamples&quot; tablename=&quot;Employees&quot;&gt;
&lt;/cfif&gt;

&lt;cfquery name=&quot;empTable&quot; datasource=&quot;cfdocexamples&quot;&gt;
   select * from employees
&lt;/cfquery&gt;

&lt;!--- This code shows the contents of the employee table and allows you to 
choose a row for updating. ---&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;cfoutput query=&quot;empTable&quot;&gt;
   &lt;tr&gt;
      &lt;td&gt;#firstName#&lt;/td&gt;
      &lt;td&gt;#lastName#&lt;/td&gt;
      &lt;td&gt;#phone#&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;cfupdate.cfm?id=#emp_id#&quot;&gt;Edit&lt;/a&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/cfoutput&gt;
&lt;/table&gt;

&lt;cfif isDefined(&quot;url.id&quot;)&gt;
   &lt;cfquery name=&quot;phoneQuery&quot; datasource=&quot;cfdocexamples&quot;&gt;
      select * from employees where emp_id=#url.id#
   &lt;/cfquery&gt;
&lt;!--- This code displays the row to edit for update. ---&gt;
   &lt;cfoutput query=&quot;phoneQuery&quot;&gt;
      &lt;form action=&quot;cfupdate.cfm&quot; method=&quot;post&quot;&gt;
      #phoneQuery.firstName# #phoneQuery.lastName# 
      &lt;input name=&quot;phone&quot; type=&quot;text&quot; value=&quot;#phone#&quot; size=&quot;12&quot;&gt; 
      &lt;input type=&quot;submit&quot; value=&quot;Update&quot;&gt;
      &lt;input name=&quot;emp_id&quot; type=&quot;hidden&quot; value=&quot;#emp_id#&quot;&gt;
      &lt;!--- The emp_id is passed as a hidden field to be used as a primary key in    
the CFUPDATE. ---&gt;
      &lt;/form&gt;
   &lt;/cfoutput&gt;
&lt;/cfif&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="DATASOURCE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DATASOURCE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Name of the data source that contains the table.</p>

  </td>
  </tr>
  </table>
</div>
<div id="TABLENAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLENAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Name of table to update. </p><ul>

<li>For ORACLE drivers, must be uppercase.</li>

<li>For Sybase driver, case-sensitive; must be in same case as used when the table was created.</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="TABLEOWNER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLEOWNER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>For data sources that support table ownership (for example, SQL Server, Oracle, Sybase SQL Anywhere), the table owner.</p>

  </td>
  </tr>
  </table>
</div>
<div id="TABLEQUALIFIER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TABLEQUALIFIER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>For data sources that support table qualifiers. The purpose of table qualifiers is as follows:</p><ul>

<li>SQL Server and Oracle: name of the database that contains the table</li>

<li>Intersolv dBASE driver: directory of DBF files</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="USERNAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">USERNAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Overrides username value specified in ODBC setup.</p>

  </td>
  </tr>
  </table>
</div>
<div id="PASSWORD">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PASSWORD</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Overrides the password value specified in ODBC setup.</p>

  </td>
  </tr>
  </table>
</div>
<div id="FORMFIELDS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FORMFIELDS</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "(all on form, except keys)"


<p>Comma-delimited list of form fields to update.</p>
<p>If a form field is not matched by a column name in the database, ColdFusion throws an error. </p>
<p>The formFields lies must include the database table primary key field, which must be present in the form. It can be hidden. </p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
