62
3.
Save the page. as
4.
View
5.
The data is inserted into the Employees table and the message appears.
To create an insert page with CFQUERY:
1.
Create a new application page in Studio.
2.
Enter the following code:
4
<CFQUERY NAME="AddEmployee"
4
DATASOURCE="CompanyInfoB">
4
INSERT INTO Employees (Fi', '#Form.LastName#',
4
'#Form.Phone#')
4
</CFQUERY>
<HTML>
<HEADER>
</HEADER>
<BODY>
<H1>Employee Added</H1>
<CFOUTPUT>
You have added #Form.FirstName# #Form.LastName# to the Employees
database.
</CFOUTPUT>
</BODY>
</HTML>
3.
Save the page. as
4.
View
5.
The data is inserted into the Employees table and the message appears.
Updating Data
Updating data in a database is usually done with two pages:
An update form
An update action page
You can create an update form with CFFORM tags or HTML form tags. The update
form calls an update action page, which can contain either a CFUPDATE tag or a
CFQUERY tag with a SQL UPDATE statement. The update action page should also
contain a message for the end user that reports on the update completion.
insertpage.cfm
in a browser, enter values, and click the Submit button.
insertform.cfm
<TITLE>Insert Action Page</TITLE>
insertpage.cfm
in a browser, enter values, and click the Submit button.
isertform.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?