Creating an Updateable Grid
Code
<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>
</cfif>
</cfloop>
</cfif>
Description
Otherwise, if the action is to insert a row,
generate a SQL INSERT query to insert
the Employee's 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.
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.
163
Need help?
Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?
Questions and answers