How to: Create Master-Detail Applications (Devices)

The following steps assume that you have a SQL Server Compact 3.5 database that has table relationships available in the Data Sources window. For more information, see How to: Create a Database (Devices).

When you drag detail tables, consider dragging only those columns that serve your purpose instead of the whole grid. You can make this choice by clicking the arrow at the right of the table name.

The following procedures assume that you have a device project open and a data source configured.


Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To create a master-detail application

  1. Drag the master table from the Data Sources window onto the form in the designer.

  2. In the Data Sources window, expand the master table to expose the detail table.

  3. Drag the detail table that you find under the master table node onto the form.


    This is the detail table as it appears in the master table, not the detail table that is at the same tree level as the master table.

    The designer automatically detects the master-detail relationship from the foreign key constraints. For more information, see Walkthrough: A Master-Detail Application.

  4. Adjust the controls on the form to suit your application.

Community Additions