Tag Archive for 'coldfusion'

Coldfusion

I work at a company where coldfusion is the main tool in web applications development. Though I am using ASP before I was hired, I still have to be focus on coldfusion so I have no choice but to learn it starting from the basics. First I decided to study the idea of how does coldfusion connects to the database, and I was amaze on how easy it is compare to other language. All you have to do is open the coldfusion administrator and and go to ODBC page and you are now ready to add a path to your database. See image below.

cfusion0
this is the ODBC page where you can choose what kind of database you will add

cfusion1
this is the create ODBC page where you will add your data source

cfusion2
this is the edit ODBC page where you can set and edit the properties of your data source

After you finished adding your data source, you can now add a coldfusion tag to your HTML to create your query. see code below.

  <CFQUERY NAME=”GetRecords” DATASOURCE=”YourDataSourceName”>
      SELECT lastName, firstName
      FROM TableName
      ORDER BY lastName, firstName
  </CFQUERY>

now to display the output, simply use the cfoutput tag. see code below.

   <CFOUTPUT QUERY=”GetRecords”>
      #GetRecords.CurrentRow#) #lastName#, #firstName#<BR>
   </CFOUTPUT>

# is equal to the % of ASP
GetRecords.CurrentRow - number of current record being displayed

sample output:

1) Abraham, Martin
2) Banks, Michelle
3) Jackson, Michael

see how easy and fast it is to access your database using coldfusion? much easy than ASP. But still ASP is the best for me. I don’t know if coldfusion has any limitations yet, I’m just starting to learn it though.