ColdFusion Tutorial

cfqury - the basic

First let?s us make an example table, here we make one contains some countries currency.

Example:
US Dollars
British Pounds
Euro
Australian Dollars
?


Give our table name: currency_table.

Then we setup the cfquery against our table.

The sql select statement will return everything from our table, starting on row one and go down to the last one.

<cfquery name="List_Currency" datasource="ds_name" username="username" password="password">

SELECT * FROM currency_table

</cfquery>

We then make the cfoutput query tag:
Remember to give it the same name as in the cfqury tag, List_Currency.

<cfoutput query="List_Currency">

#currency#<br>

</cfoutput>

This will give the following output:
US Dollars
Hong Kong Dollars
Australian Dollars
British Pounds
Canadian Dollars
Danish Krona
Euro
Japanese Yen
Malaysian Ringitt
Swiss Francs
New Zealand Dollars
Norwegian Krona
Singapore Dollars
South African Rand
Swedish Krona

If we make a change in our cfquery, we can sort (order) the list.

<cfquery name="List_Currency" datasource="datasource" username="username" password="password">

SELECT * FROM currency_table ORDER BY currency

</cfquery>

This will give the following output:
Australian Dollars
British Pounds
Canadian Dollars
Danish Krona
Euro
Hong Kong Dollars
Japanese Yen
Malaysian Ringitt
New Zealand Dollars
Norwegian Krona
Singapore Dollars
South African Rand
Swedish Krona
Swiss Francs
US Dollars


Syntax

<cfquery name = "query_name"

dataSource = "ds_name"

dbType = "type"

dbServer = "dbms"

dbName = "database name"

connectString = "connection string"

username = "username"

password = "password"

maxRows = "number"

blockFactor = "blocksize"

timeout = "milliseconds"

cachedAfter = "date"

cachedWithin = "timespan"

provider = "COMProvider"

providerDSN = "datasource"

debug>

 

SQL statements

 

</cfquery>

 

ColdFusion Tutorial test

cfqury - the basic

No test is available or implemented for this ColdFusion Tutorial.

No User Comments.

No User Comments, be the first one to write your comments?

Add your comments

Your Name*:
Your Email:
Site URL:
Site Name:
Comemt Title*:
Your Comment*:
Key Phrase*:
wN8
Your IP Address: 38.103.63.62
 

ScandicWeb is own by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.

[Home [Site Map [Privacy Statement [Site Feedback] [About ScandicWeb]


[ColdFusion [Flash [Search Engine Optimization [Graphics [Cascading Style Sheets (CSS) [JavaScript (JS) [Software]

Partner sites: ScandicSoft


Server time: 19. November 2008 Wednesday