User Guide

Creating an Updateable Grid 163
<cfelseif
Form.employee_grid.rowstatus.action[counter] is
"I">
<cfquery name="InsertNewEmployee"
datasource="CompanyInfo">
INSERT into Employee
(LastName, Dept_ID)
VALUES
(#Form.employee_grid.LastName[Counter]#,
#Form.employee_grid.Dept_ID[Counter]#)
</cfquery>
Otherwise, if the action is to insert a row,
generate a SQL INSERT query to insert
the Employees last name and department
ID from the grid row into the database. The
Insert operation assumes that the DBMS
automatically increments the Emp_ID
primary key. If you use the Dbase version
of the CompanyInfo database that is
provided for UNIX installations, the record
is inserted without an Emp_ID number.
</cfif>
</cfloop>
</cfif>
Close the cfif tag used to select among
deleting, updating, and inserting.
Close the loop used for each row to be
changed.
Close the
cfif tag that surrounds all the
active code.
Code Description