Updating The Database With Cfgridupdate - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Creating an Updateable Grid
Reviewing the code
The following table describes the code and its function:
Code
<cfgrid name="employee_grid"
<cfgridcolumn name="Emp_ID"
<cfgridcolumn name="LastName"
<cfgridcolumn name="Dept_ID"

Updating the database with cfgridupdate

The
including inserting and deleting records. It can add, update, and delete records
simultaneously. It is particularly convenient because it automatically handles
collecting the
appropriate SQL statements to update your data source.
In most cases, you should use
tag does not provide the complete SQL control that
height=300
width=250
vspace=10
selectmode="edit"
query="empdata"
insert="Yes"
delete="Yes">
header="Emp ID"
width=50
headeralign="center"
headerbold="Yes"
select="No">
header="Last Name"
width=100
headeralign="center"
headerbold="Yes">
header="Dept"
width=35
headeralign="center"
headerbold="Yes">
tag provides a simple mechanism for updating the database,
cfgridupdate
changes from the various form variables and generates
cfgrid
It can update only a single table.
You have no control over the order of changes. Rows are deleted first, then rows
are inserted, then any changes are made to existing rows.
Updating stops when an error occurs. It is possible that some database changes
are made, but the tag does not provide any information on them.
Description
Populate a
cfgrid
empdata query. Selecting a grid cell enables you
to edit it. Rows can be inserted and deleted. The
grid is 300 X 250 pixels and has 10 pixels of
space above and below it.
Create a 50-pixel wide column for the data in the
Emp_ID column of the data source. Center a
header named Emp ID and make it bold.
Do not allow users to select fields in this column
for editing. Since this field is the table's primary
key, users should not be able to change it for
existing records and the DBMS should generate
this field as an automincrement value.
Create a 100-pixel wide column for the data in
the LastName column of the data source. Center
a header named Last Name and make it bold.
Create a 35-pixel wide column for the data in the
Dept_ID column of the data source. Center a
header named Dept and make it bold.
to update your database. However, this
cfgridupdate
control with data from the
provides. In particular:
cfquery
159

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents