Usage Sample for RelDBQueryDataSource Element

Top  Previous  Next

This topic demonstrates how to access a Microsoft Access database and query it.

Assume that we have a Microsoft Access database with name "SampleDB". The file name of the database is "c:\data\SampleDB.mdb".

Assume that the table "STAFF" contains the following records.

accessreldb

Steps
 

Create a new project in MoreMotion Application Studio
Open "Common Definitions" page by pressing CTRL + F7
Place "mor > RelDB > RelDBConnection" element into the page and configure it as follows

 

RelDBConnection_props

Afterwards place a "mor > RelDB > RelDBQueryDataSource" element into the Common Definitions page

RelDbConnection_add

 

and define its properties as follows:

RelDBDataSource_props

 

The data source "staff" is ready to access "c:\data\SampleDB.mdb" with query "SELECT * FROM staff". The XML data provided by the "staff" data source will be similar to the following.

 

 <staff>

  <item>

    <Name>John</Name>

    <Surname>Doe</Surname>

    <Gender>M</Gender>

    <Firm>Color Advertisement Company</Firm>

  </item>

  <item>

    <Name>Peggy</Name>

    <Surname>Lane</Surname>

    <Gender>F</Gender>

    <Firm>Aqua Textile Firm</Firm>

  </item>

  <item>

    <Name>Sue</Name>

    <Surname>Ellen</Surname>

    <Gender>F</Gender>

    <Firm>Backward Company</Firm>

  </item>

  </staff>

 

 

Prepare Dynamic elements

Insert a panel element into page "index".
Locate its "Repeat | For Each" property in property editor and enter "/staff/item"
Place two text elements into panel element one under another and specify their values as follows

ref_dynamic_elements

We shall now deploy the project and start the web server.

Use menu command "Project | Deployment | Build Active Deployment" to build the project.
Use menu command "Project | Deployment | Start Web Server" to run the Tomcat.
Use menu command "Project | Deployment | Go to Web Application" to start the browser and go to index page of the Web Application.

 

The result should be similar to the following.

example_browser_result