Master Detail Data Sample
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.
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.
To run the sample
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.
Select a number in the Unfulfilled Orders list.
The worksheet is populated with details from the order.
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.