The cfgridupdate
tag provides a simple mechanism for updating the database, including inserting and deleting records. It can add, update, and delete records simultaneously. It is convenient because it automatically handles collecting the cfgrid
changes from the various form variables, and generates appropriate SQL statements to update your data source.
In most cases, use the cfgridupdate
tag to update your database. However, this tag does not provide the complete SQL control that the cfquery
tag provides. In particular, the cfgridupdate
tag has the following characteristics:
<html> <head> <title>Update grid values</title> </head> <body> <h3>Updating grid using cfgridupdate tag.</h3> <cfgridupdate grid="employee_grid" datasource="cfdocexamples" tablename="Employee"> Click <a href="grid2.cfm">here</a> to display updated grid. </body> </html>
Note: To update a grid cell, modify the cell contents, and then press Return.
The following table describes the highlighted code and its function:
Code | Description |
---|---|
<cfgridupdate grid="employee_grid" |
Updates the database from the Employee_grid grid. |
datasource="cfdocexamples" |
Updates the cfdocexamples data source. |
tablename="Employee" |
Updates the Employee table. |