Version 2.0
|
|
| Index : Creating Your First Graph | |
|
|
|
| 1. Creating an Access Database |
|
1. Create a project directory. For example 'c:\inetpub\myproject'. 2. Within this directory create two subdirectories; 'Datasource' and "WWWRoot". The Datasource directory will be used to hold the database, and the WWWRoot directory to hold the web pages using the datasource. 3. Open Access, a dialog box will appear, select the check box to create a blank database. Save the blank database as MyDb.mdb to the directory 'c:\inetpub\myproject\datasource\'. 4. You will now be presented with main database management window. Click on the 'Tables' tab and then the 'New' button. This will create a new table within your database (see Fig 1.1). Select the design view. |
|
|
| 1.1 Creating a New table in MS-Access | ||
|
5. In the design view type 'month' in the 'Field Name' column and in the corresponding 'Data Type' column select text from the drop down combo box (se Fig 1.2). 6. Save the file as 'Sample' and close the design view. Now right click anywhere over the row and select 'Primary Key' from the menu that appears. The Primary key allows the database to assign a unique ID to each record in your database. In this case it uses the text in Month for the IDs. On the second row type 'figures' and select 'number' as the Data Type. 7. Select the Table tab and double click on 'Sample'. This opens the table, enter the months Jan to Dec in the months' column, enter data in steps of 5 in the figures column. 8. Save the table.
|
|
| 1.2 Setting field data-types. |
| 2. The ColdFusion Server |
|
In order for ColdFusion to able to use the database that you have just created, you must first register it as an ODBC (Open DataBase Connectivity) source. This means that any ODBC application (including ColdFusion) can access the database using standard windows libraries. |
|
|
Registering the database is a simple procedure, and is done using the ColdFusion Administrator. 1. Open the ColdFusion Administrator. This can normally be found on start menu under 'ColdFusion Server 4.x' 2. Select 'ODBC' under the 'Datasources' header on the left of the window. 3. The ODBC driver for Access should be displayed as a default driver. Click on 'Add'. 4. Type MyDataSource for the Data Source Name and type in or type the directory structure (see Fig 1.3). 5. Make sure there is no 'Default Login'. 6. Select 'Create' |
|
| 1.3 Setting field data-types. | |
| 3. The Application |
|
1. Load Cold Fusion Studio 2. Open a new default .cfm file 3. At the top of the page type the query or if you choose use the wizard available. <cfquery name="MyQuery" datasource="MyDataSource" dbtype="ODBC"> 4. Within the query object type Select * from Sample 5. We can now create our CFXGraphicsServer tag. <CFX_GraphicsServer 6. Now browse the page |
|
![]()