Adding a Database or Table to a Report

When designing a report, you will need to add additional databases or tables from time to time as the need arises. In the sample reports included with this chapter, there is an Employee Profile (Employee_Profile_Basic) that lists employee names, birth dates, and hire dates. It does not list the employee's city; that information is held within another table that we are going to add to the report.

To start, open Employee_Profile_Basic in Visual Studio .NET by double-clicking the solution (.sln) file within that folder. Double-click employee_profile.rpt to open it in the Report Designer. Look at the four fields that are displayed in the report, and then look in the Field Explorer (View ^ Other Windows ^ Document Outline), where you will see the Employee table under Database Fields, as shown in Figure 7-3

We want to add the City to the report, but it isn't available from this table, so we are going to have to add the table that it is in. Right-click anywhere within the report, and select Database ^ Add/Remove Database, to open the Database Expert dialog (shown in Figure 7-4), which you can then use to add additional data structures to the report.

Figure 7-3

Locate the Xtreme Sample Database and expand the node to find the table you wish to add, in this case, Employee_Addresses. Select the table name and click the arrow icon to add it to the right window, which indicates that it has been added to your report. You can add further databases or tables here. When you have finished, select the Links tab, which allows you to specify the relationships between these tables, as shown in Figure 7-5.

B Datahase (Expert

Link together the tables you added Id the repoil.

Linking is needed to match records of one table with corresponding records of another table.

Link together the tables you added Id the repoil.

Linking is needed to match records of one table with corresponding records of another table.

Employee

Was this article helpful?

0 0

Post a comment