IBX.InterBase ToGo Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows how to monitor trace flags on an InterBase database connection. It requires InterBase to be installed on the machine or to connect to a remote server. Make sure that the InterBase server is running before you run the example.

Location

You can find the Monitor Demo project at:

  • Start | Programs | Embarcadero RAD Studio Rio | Samples and then navigate to CPP\Database\IBX\InterBaseToGo.
  • Subversion Repository:
    • You can find C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

This sample has two TStringGrid components. The grid on the top shows the content of the Customer table from the Employee database. The lower grid is related to the grid on the top, and it shows all the records from the Sales table associated with the selected customer.

This sample runs on Win32, Win64, and on Mac OSX versions starting with 10.9.

How to Use the Sample

  1. Navigate to the location given above and open:
    • CppIBToGoDemo.cbproj
  2. Press F9 or choose Run > Run.
  3. Select the Employee GDB check box to connect to the database.
  4. Use the navigators to go through the records of the grids.

Files

File in C++ Contains

CppIBToGoDemo.cbproj

The project itself.

MainForm.cpp/dfm

The main form and the code to give the functionality to the sample.

Implementation

This sample uses a TIBDatabase component to connect to the EMPLOYEE.gdb database, which is available in the C:\Users\Public\Documents\Embarcadero\Studio\\Samples\Data directory.

The relations on the different database components are created using LiveBindings. Select View > LiveBindings Designer to open the LiveBindings Designer pane where you can see the bindings between the components. You can also see the relations in the TBindingsList component, this component is automatically added to the project once a relation using livebindings is created.

The Data.Bind.DBScope.TBindSourceDB is a nonvisual component that appears automatically after creating the binding.

The Data.Bind.DBScope.TBindSourceDB allows the connection between the IBX.IBCustomDataSet.TIBDataSet and the access components: FMX.Grid.TStringGrid and Fmx.Bind.Navigator.TBindNavigator.

Right-click the IBDataSet1 component and click Edit SQL to see the SQL query that the dataset is using to show the data. The IBDataSet2 creates the relation between the two tables with the SQL Query: "select * from sales where Cust_No = :Cust_No".

Uses

See Also