Building the Inventory Recordset


One of the dynamic elements that the client has requested is a database-driven section of the site that displays the motorcycles that are currently for sale. To accommodate this, a field called status has been created in the tbInventory table. This field is set to record either a 0 or 1 value, with 0 being for sale and 1 being sold. Before you can display the motorcycles that are for sale on the site, you need to build a recordset that contains only those motorcycles that are currently for sale.

1.

In Dreamweaver, switch to or open the forsale.cfm page.

2.

On the Server Behaviors panel, click the plus sign and choose Recordset from the menu. In the Recordset dialog box, type the name rsForSale, choose the dsnRetrosCycles data source, and choose the tbInventory table (see Figure 30.9).

Figure 30.9. Choose a name, connection, and table for your recordset.


Note

Because the original page was developed in an HTML template and then converted to a ColdFusion page, you might need to reconfigure your site so that the test server address is set to http://localhost:8500/retroscycles before you can create your recordset. You can adjust this in the settings for your site.

3.

Next, click the Selected radio button to limit the fields that are retrieved from the database. Using the Ctrl key and the mouse, select the inventoryid, year, make, model, and color fields. Set a filter that retrieves only records where the status is equal to the entered value of 0, as shown in Figure 30.10. Click OK to create the recordset.

Figure 30.10. Choose the appropriate field and set a filter for the recordset.


4.

Save the page.



Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net