Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>&lt;cfupdate&gt;</code> is not designed to contain SQL. Just use this:</p> <pre><code>&lt;cfupdate datasource="XXXXX" tablename="Suppliers" /&gt; </code></pre> <p>and make sure that your form field names match the table column names. ColdFusion will create the appropriate UPDATE statement for you. </p> <p>It will figure out what columns you want to update by comparing form field names with table column names. It will also figure out the table's primary key and use that in the <code>WHERE</code> clause.</p> <p>Note that <code>&lt;cfupdate&gt;</code> is made for very simple situations. It is an easy way to update a basic table, but it might not always be the best fit for what you intend to do.</p> <p>If you want more control over the update statement, use <code>&lt;cfquery&gt;</code> and <code>&lt;cfqueryparam&gt;</code>.</p> <pre><code>&lt;cfquery datasource="XXXXX"&gt; UPDATE Suppliers SET SupplierName = &lt;cfqueryparam value="#FORM.SupplierName#" cfsqltype="CF_SQL_VARCHAR" /&gt;, Address1 = &lt;cfqueryparam value="#FORM.Address1#" cfsqltype="CF_SQL_VARCHAR" /&gt;, Address2 = &lt;cfqueryparam value="#FORM.Address2#" cfsqltype="CF_SQL_VARCHAR" /&gt;, City = &lt;cfqueryparam value="#FORM.City#" cfsqltype="CF_SQL_VARCHAR" /&gt;, WHERE SupplierCode = &lt;cfqueryparam value="#txtSupplier#" cfsqltype="CF_SQL_VARCHAR" /&gt; &lt;/cfquery&gt; </code></pre> <p>Also note that <code>?</code> generally is <em>not</em> the way to specify parameters in ColdFusion. That's what <code>&lt;cfqueryparam&gt;</code> is for.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload