User Guide
cfgridupdate 207
Example
The following example lets you update a database by using a cfgrid tag to add and delete entire
records or to update the data in individual cells. The
cfgridupdate tag processes the data from
the submitted form and updates the database.
<!--- If the gridEntered form field exists, the form was submitted.
Perform gridupdate. --->
<cfif IsDefined("form.gridEntered") is True>
<cfgridupdate grid = "FirstGrid" dataSource = "cfdocexamples" Keyonly="true"
tableName = "CourseList">
</cfif>
<!--- Query the database to fill up the grid. --->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Course_ID, Dept_ID, CorNumber,
CorName, CorLevel, CorDesc
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</cfquery>
<h3>cfgrid Example</h3>
<I>Try adding a course to the database, and then deleting it.</i>
<cfform>
<cfgrid name = "FirstGrid" width = "450"
query = "GetCourses" insert = "Yes" delete = "Yes"
font = "Tahoma" rowHeaders = "No"
colHeaderBold = "Yes"
selectMode = "EDIT"
insertButton = "Insert a Row" deleteButton = "Delete selected row" >
</cfgrid><br>
<cfinput type="submit" name="gridEntered">
</cfform>...
tableQualifier Optional Table qualifier, if supported. Purpose:
• SQL Server and Oracle driver: name of database that
contains the table.
• Intersolv dBASE driver: directory of DBF files.
keyOnly no Applies to the
update action:
• yes: the WHERE criteria are limited to the key values.
• no: the WHERE criteria include key values and the
original values of changed fields.
Attribute Req/Opt Default Description