hub.eb?material_id=409&track_id=408

Using Multiple Row Database Resources


A Database Resource can also be configured for use with multiple rows. A table can be backed by such a Database Resource by setting the table's Resource property.

To configure a Database Resource in this way, the For use with Table operations (multiple rows) option should be checked.

The following operations are available via the tables interface:

  • Load a resource and populate a mapped table: tables.myTable.fetchTable()
  • Update the database to reflect any changes made to rows in a mapped table: tables.myTable.updateTable()
  • Insert a new row into the table: tables.myTable.insertRow()
  • Delete the current row from the table: tables.myTable.deleteRow()

When performing insert or delete operations the changes are not made on the database until the updateTable() function is called.

The delete operation will remove the current row from the table. You may have to loop through the rows of the table to find a specific row to delete.

Steps


1

Create a Database Resource named myDatabaseResource. Use the following settings to access the PETS table in the EBASE_SAMPLES database:

2

Create a Form and add the Database Resource

3

Add a Table, myTable, choose the resource from the Resource Name drop-down and import the columns from the resource.

Drag the table onto your Page as a Table Control.

4

Add a Button Control to the Form and give it an On Click event with the following code:

tables.myTable.fetchTable();
5

Run your form. When you click the button the table will be populated from the database.

Current Module

Related