C# Dataset with multiple tables
Posted on 2010-09-09
We have many datasets that we use to bind our controls and these datasets contain multiple tables with relationships.
One example dataset has 3 tables - customer, customerphone and phone. Customerphone is the linking table between the other two and is many to one relationship with both.
First, how do you bind a control with this dataset (like LIstview) and obtain access to all tables in a binding event like OnItemDataBound? Seems that it just binds to the primary table every time.
Secondly and more importantly, in some event like a OnItemDataBound if we were to have access to all table records, how do we find the phone records that pertain to the current ListViewDataItem? Not sure if just those records that pertain are available or if we would have to select on the remaining tables?
Please provide specific details, code samples preferred. Thanks.