Using a variable as a data source for a ColdFusion recordset
When you define a recordset for a page in the Bindings panel, Dreamweaver enters the name of the ColdFusion data source in the
cfquery tag on the page. For more flexibility, you can store a data source name in a variable and use the variable in the
cfquery tag. Dreamweaver provides a visual method of specifying such a variable in your recordsets.
To visually specify a variable as a data source for a recordset:
- Make sure a ColdFusion page is active in the Document window.
- In the Bindings panel, click the Plus (+) button and select Data Source Name Variable from the pop-up menu.
The Data Source Name Variable dialog box appears.
- Define a variable and click OK.
- When defining the recordset, select the variable as the Data Source for the recordset.
In the Recordset dialog box, the variable appears in the Data Source pop-up menu along with the ColdFusion data sources on the server.
- Complete the Recordset dialog box and click OK.
- Initialize the variable.
Dreamweaver does not initialize the variable for you so that you can initialize it how and where you want. You can initialize the variable in the page code (before the
cfquery tag), in an include file, or in some other file as a session or application variable.