140
<CFELSEIF form.employee_grid.rowstatus.action[Counter] IS "U">
Employee_ID=#form.employee_grid.original.Employee_ID[Counter]#
<CFELSEIF form.employee_grid.rowstatus.action[Counter] IS "I">
#form.employee_grid.Department_ID[Counter]#)
</CFIF>
</BODY>
</HTML>
3.
Save the file as
4.
View
To update the data source with CFQUERY
1.
Open a new file in Studio.
2.
Modify the file so that it appears as follows:
<CFGRIDUPDATE GRID="Employee_grid"
3.
Save the file as
4.
View
</CFQUERY>
<CFQUERY NAME="UpdateExistingEmployee"
DATASOURCE="CompanyInfo">
UPDATE Employees
SET
LastName='#form.employee_grid.LastName[Counter]#',
Department_ID=#form.employee_grid.Department_ID[Counter]#
WHERE
</CFQUERY>
<CFQUERY NAME="InsertNewEmployee"
DATASOURCE="CompanyInfo">
INSERT into Employees
(Employee_ID, LastName, Department_ID)
VALUES (#form.employee_grid.Employee_ID[Counter]#,
'#form.employee_grid.LastName[Counter]#',
</CFQUERY>
</CFIF>
</CFLOOP>
handle_grid.cfm
in your browser, make changes to the grid, and then submit them.
grid2.cfm
DATASOURCE="CompanyInfo"
TABLENAME="Employees"
KEYONLY="NO">
handle_grid.cfm
in your browser, make changes to the grid, and then submit them.
grid2.cfm
Developing Web Applications with ColdFusion
.
.
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers