Top
PowerCOBOL V11.0 Reference
FUJITSU Software

3.8.1 Accessing Table Data

The DBAccess control can be connected to a data source that supports ODBC functions.

Data in tables can be referenced, added, updated and deleted by using the SelectRecords and RewriteRecord methods.

You can specify the target to be processed in the DBAccess property page by following these steps:

  1. Set Target Type.
    Select "Table or View".

  2. Select the Data Source to connect to.
    Select the "Connect" button and enter the requested information such as data source name and database.

  3. Select the target table or view.
    Select the "Target" button and input a table name (or a view name) to be processed.

  4. Select the Fields to be used.
    Select the "Fields" button and set the fields to be processed. The records to be read are limited by entering a condition conforming to the ODBC SQL grammar in the Condition field.

  5. Set other information
    Select the "Others" button and set the following information:

    • Key field
      To mark a field as a key field, select "Key field" in "Set record attributes". Double-click the field in the "Selected field list". This sets the field as a key.
      To release the setting, double-click the field again.
      Multiple fields can be set as keys.

    • Sort on input
      To indicate that a field is to be sorted, select "Sort on input" in "Set record attributes". Double-click the field in "Selected field list". This sets the field as an ascending key. Double-clicking again sets the fields as a descending key.
      If you double-click the field once again, the setting is released.
      Multiple fields can be set as sort fields.

    • Setting cursor type
      Select the appropriate setting in the "Cursor type" group box. The choices other than FORWARD_ONLY also enable reading forward. Some options may not operate correctly because of the manner in which the ODBC driver functions.

    • Selecting commit mode
      Select the appropriate setting in the "Commit mode" group box.

    • Lock Records
      If you select "Lock Records", the record selected when the SelectRecords method is invoked is locked (FOR UPDATE clause is used in SELECT statement). This option may not operate correctly because of the manner in which the ODBC driver functions.

    • Read only
      If the data does not need to be updated, select Read only.

    • Cursor Concurrency
      Specifying a value other than READONLY enables updating and deleting the current data using the cursor. Some options may not operate correctly because of the manner in which the ODBC driver functions.

  6. Apply your changes
    Select the "Apply" button to save the information you have set.

  7. Close the Property page
    Select the "OK" button and close the property page.