I have followed the instructions on MSDN to "Display Related Data in a Windows Application" ( http://msdn.microsoft.com/en-us/library/57tx3hhe(VS.80).aspx ).

I have a data source that has a Customers table and a related Orders table.

I can easily create a form which allows the user to select a Customer and display the related Orders.

However, I cannot figure out how to create a form to select an Order and display the related Customer details (essentially the reverse of the MSDN example).

The relationship between the tables is Customers.CustomerID (PK) -> Orders.CustomerID (FK). Referential integrity is enforced (i.e. a Customer cannot be added to Orders table if they do not exist in the Customers table).

I must be missing something obvious. Can someone please point me in the right direction. Any advice is much appreciated.

With some guidance from DeborahK on MSDN Forums I have managed to configure a TableAdapter to Use SQL joins by following this tutorial: http://www.asp.net/learn/data-access/tutorial-69-vb.aspx

I had originally tried creating joins in the TableAdapter SQL, but this resulted in a TableAdapter which was not updatable (no insert, update, delete methods). The trick is to use Stored Procedures which is clearly detailed in the tutorial.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.