databasedelphidbgrid

How to show the data related to an ID instead of the ID?


In summary, I have a database (Access) with 4 related tables, as seen in the picture:

image

In Delphi, I have a TDBGrid that shows the data from the "resultas" table (using TADOTable), as seen here:

image

As you can see, the field for the test id shows numbers (id of the test). What I want is to show the test name instead of that number. Or, can I add a field (in Delphi) that shows the name of the test related to the id (a calculated field, maybe)?


Solution

  • You need Lookup field defined in TADOTable component which is responsible for "Resultas" table. Defining a Lookup Field

    Keep in mind that big datasets could result to poor performance. The correct way is to use SELECTs with JOINs in TADOQuery.