Category Archive for: Using CFQuery and SQL to Interact with the Database

Building Dynamic Queries

Onceyou have mastered CFQUERY and building static SQL statements, you will start wondering about how to dynamically build SQL queries within your ColdFusion application. With ColdFusion you can build these dynamic queries quite easily. You can insert dynamic parameters in your SQL statement or within your CFQUERY tag. These dynamic parameters are ColdFusion variables such as: • Client, session,…

Read More →

CFTRANSAGION

When processing data, you sometimes will require a series of steps to complete a certair task. This is known as a transaction. If one of the steps is not completed, then the whole transaction should be cancelled or should be repelted from ste 1.You may also require a locking mechanism while communicating with your database. ~ou might need…

Read More →

Using the SQL Builder Tool

The SQL Query Builder tool enables you to create a CFQUERY, complete with the SQL query, through a graphical interface. To create a query, follow this procedure: 1. Right-dick the data source that you would like to build a new query 2. Select “New Query.” 3. Select the desired table 4. The Query Builder screen appears.…

Read More →

Using ColdFusion Studio’s SQL Builder

Using ColdFusion Studio, you can build a SQL query without leaving the integrated development environment (IDE) for the Cold Fusion development system. One of the tools available to you is the SQL Query Builder, which enables you to view the database schema and construct and test SQL operations for inclusion in your templates. This chapter has demonstrated the basics…

Read More →

Evaluation Precedence

When working with multiple WHERE conditions, it is important to take into account the order in which conditions are evaluated. If you are not at least aware of the order, then you might not correctly anticipate the results. Conditions are evaluated in the following order: • Parentheses () • NOT • AND • .OR It is also helpful…

Read More →

Arithmetic Operators

Arithmetic operators are used to perform mathematical calculations on fields. Some of them can also be used to work with strings. There are four arithmetic operators described When working with more than one arithmetic operator, there is precedence when evaluating their calculations. They are resolved in this order: multiplication, division, addition, and subtraction. Of course, you can use parentheses…

Read More →

Updating Database Records

Eventually, you may find the need to modify existing database records. Whether it is to correct an error or update old information, you need to use a SQL UPDATE statement inside of a CFQUERY tag. In the UPDATE statement, you must tell ColdFusion which table and fields to modify. In  section, you will use the Cosby Speakers Bureau…

Read More →

‘Using Standard Variables hturned by the CFQMERY Tag

In-addition to the fieldnames that you specify in your SELECTstatement, Coldfusion returns several other query-related variables. They can be used in the same manner as all other returned query variables. The CFQUERYtag standard variables are: • recordcourrt-provides the total number of records returned in a query result set. The number may be misleading if you are grouping your…

Read More →

Outputting Query Results’

Now that you have learned various ways to retrieve data from a database, you need to learn how to output the data in your ColdFusion template. To do this you will be using the CFOUTPUT tag. The CFOUTPUT tag has several optional attributes. In order to display query results, you must add the QUERY attribute to the…

Read More →

Database Tables

category_desc’ Stores categories that speakers can be listed under. This table is tied to. the speaker_category table through the speaker _category_ i d field. These tables are all related through primary keys and foreign keys. Once you have opened the sybex. mdb file In Access you can see the table relationships by selecting Tools/’Relationships on the Access menu bar.…

Read More →

Back to Top