![MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual Download Page 48](http://html1.mh-extra.com/html/macromedia/coldfusion-5-developing/coldfusion-5-developing_develop-manual_3293641048.webp)
28
Chapter 3 Querying a Database
•
Some DBMS vendors use nonstandard SQL syntax (known as a dialect) in their
products. ColdFusion does not validate the SQL in a
cfquery
, so you are free to
use any syntax that is supported by your data source. Check your DBMS
documentation for nonstandard SQL usage.
Building Queries
As discussed earlier in this chapter, you build queries using the
cfquery
tag and SQL.
To query the table:
1
Create a new application page in ColdFusion Studio.
2
Edit the page so that it appears as follows:
<html>
<head>
<title>Employee List</title>
</head>
<body>
<h1>Employee List</h1>
<cfquery name="EmpList" datasource="CompanyInfo">
SELECT FirstName, LastName, Salary, Contract
FROM Employee
</cfquery>
</body>
</html>
3
Save the page as emplist.cfm in my
apps
under the Web root directory. For
example, the directory path on your machine might be:
C:\INETPUB\WWWROOT\myapps on Windows NT
4
Return to your browser and enter the following URL to view EmpList.cfm:
http://127.0.0.1/myapps/emplist.cfm
5
View the source in the browser.
The ColdFusion Server creates the EmpList data set, but only HTML and text is
sent back to the browser so you just see the heading “Employee List”. To display
the data set on the page, you must code tags and variables to output the data.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...