Complex Data Binding in Windows Forms

In the next example, you will build a quick-and-dirty Windows Form that will display all customers in a bound ListBox and the customer's associated Orders in a bound DataGrid. A more complex DataSet will be needed that provides the relationship path to traverse from customers to orders using the primary key of Customers (CustomerID) to foreign key in Orders (CustomerID). You will have to do data bindings for both the ListBox control and the DataGrid control. This example is one of the classic data binding scenarios described earlier.

Create a New Project in VS .NET

1.
Create a new project in VS .NET by choosing File, New, and then choosing the Project option. Or, you can just modify the “ADO.NET24hoursDB” ...

Get Sams Teach Yourself ADO.NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.