
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 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.
</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
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...