MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 181

Table of Contents

Advertisement

Creating an Updateable Grid
3
4
<br>
</cfoutput>
<cfif Form.employee_grid.rowstatus.action[counter] is "D">
<cfquery name="DeleteExistingEmployee"
datasource="CompanyInfo">
DELETE FROM Employee
WHERE
Emp_ID=#Form.employee_grid.original.Emp_ID
[Counter]#
</cfquery>
<cfelseif Form.employee_grid.rowstatus.action[counter] is "U">
<cfquery name="UpdateExistingEmployee"
datasource="CompanyInfo">
UPDATE Employee
SET
LastName='#Form.employee_grid.LastName[Counter]#',
Dept_ID=#Form.employee_grid.Dept_ID[Counter]#
WHERE
Emp_ID=#Form.employee_grid.original.Emp_ID
[Counter]#
</cfquery>
<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>
</body>
</html>
Rename your existing handle_grid.cfm file if you wish to save it, then save this file
as handle_grid.cfm.
View
in your browser, make changes to the grid, and then submit
grid2.cfm
them.
161

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents