Product Documentation

ODBC - c-tree Plus Edition

Previous Topic

Next Topic

Tutorial

  1. Start Microsoft Query (double click the Microsoft Query icon).
  2. Select New... from the Microsoft Query File menu.
  3. From the Choose Data Source dialog box, choose the Databases tab. For simplicity, remove the checkmark from “Use the Query Wizard to create/edit queries”. Highlight the c-tree ODBC Driver, and click OK.
  4. In the Add Tables dialog box listing the four sample files, continue by adding all four files in the order shown in the figure below (Choose each file and select Add). After adding all four files click Close. The Microsoft Query active window should appear similar to the following:

  5. Add file relationships between the four by selecting the cm_custnumb field in the CUSfile by clicking and holding the left mouse button. Drag the cursor over to the co_custnumb field in the ORDERS file and release the left mouse button. This should draw a line between the two fields, as shown in the figure below. Using this figure and the following table, relate the ORDERS file to ORDER_DETAIL and ORDER_DETAIL to the ITEMS file.

    Data File1

    Common Field

    Data File 2

    Common Field

    CUSTOMERS

    cm_custnumb

    ORDERS

    co_custnumb

    ORDERS

    co_ordnumb

    ORDER_DETAIL

    oi_ordnumb

    ORDER_DETAIL

    oi_itemnumb

    ITEMS

    im_itemnumb

  6. Once the files are related, double-click any field to retrieve the data for that file. Since the files are all related, the corresponding data across files will be properly aligned.

    Note: To select all fields for a particular file using Microsoft Query, double click the asterisk (*) at the top of the file box.

  7. The last step for this tutorial is to insert (write) a few new records into a data file. By default, all c-tree ODBC Drivers are read ONLY. It is possible to enable writes for all but the c-tree Read ONLY Driver, but by doing so you are taking responsibility for the integrity of your data. The authors of your c-tree Plus application have taken extreme care to ensure the integrity of your data files. For example, in an accounting system, an order total may be the sum of several individual products. If you override the price of one of the products, and do not adjust the order total accordingly, the data integrity could be compromised. If you are prepared to take responsibility for the integrity of your data, the c-tree ODBC Driver can be enabled for writing by using the ODBC Setup icon (see “ODBC/ApplicaSetup”). If you are unsure about the ramifications of enabling the write feature, consult the software vendor of your c-tree Plus application. If you decide to enable the write capability, the following steps may be used to verify its operation. Microsoft Query only allows single file updates. For this reason, do the following:
    1. Remove all but one of the data files from your query. We deleted Orders, Order_Detail, and Items. This is done by highlighting the file to be removed and pressing the delete key.
    2. Pull down the Records menu and enable Allow Editing.
    3. Display the desired fields.
    4. Using the Customers scroll bar, move to the end of the Customers data. The last record in a file enabled for inserts will have an asterisk (*) in the first column.
    5. Enter data into the desired fields and then press Enter to insert the data. Once the last field has been filled in, press the Enter or Tab key to go to the first column of the next row. This inserts the new data and updates the record count in the bottom left corner of the dialog box.

TOCIndex