Fill dataset with specific record along with related child records
Posted on 2007-10-16
I have a form onto which I've dragged a datatable from a typed datasource. I've then dragged several child datatables onto the same form so I can now successfully retrieve all records for that dataset.
I then added a query to the parent datatable's tableadapter so that I could search for specific records based on a passed parameter. The parent records are retrieved but the child records are not. I know that I need to write code to fill the child datatables but I don't know how to do this part.
I'm guessing that I need to create additional queries on the other tableadapters that accept parameters for the foreign keys, but how do I write the code that actually fills each of these datatables? Do I use the parent datatable's bindingsource somehow to get it's primary key etc...