Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Excel-Based Samples
 Master Detail Data Sample
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Microsoft Visual Studio Tools for the Microsoft Office system (version 3.0)
Master Detail Data Sample

Updated: November 2007

Note:

This sample runs only in Microsoft Office Excel 2007.

This sample demonstrates how to retrieve data from a relational database or XML file and use that data in Excel.

The sample is an order fulfillment worksheet. The worksheet displays details of customer orders so that the items can be packed for shipping. The worksheet also displays current inventory for each item so that the user knows if the order can be fulfilled.

Security Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

For information about installing the sample project on your computer, see How to: Install and Use Sample Files Found in Help.

Download sample

To run the sample

  1. Press F5.

  2. Select a customer name in the Select a Customer list.

    The Unfulfilled Orders list is populated with the numbers of orders that have not been marked Fulfilled.

  3. Select a number in the Unfulfilled Orders list.

    The worksheet is populated with details from the order.

  4. In the Indicate Order Status list, click Fulfilled.

    After the status is set to Fulfilled:

    • The order status is saved back to the in-memory dataset.

    • The quantity ordered for each product in the order is subtracted from the UnitsInStock element of that same product in the in-memory dataset. This ensures that the proper UnitsInStock value of each product is available for the next order.

    • The order is removed from the Unfulfilled Orders list.

This sample demonstrates how to:

  • Retrieve and use data from an XML file that was extracted from a SQL Server database.

  • Display the data using data-bound Excel controls.

  • Work with multiple sets of master/detail data.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker