title: Filter DataSet for relational data
body: <p>I have few tables in the database with parent table say P is having 1:1 relation with some child tables whereas having 1:M relation with other child tables.</p>
  
  <p>For this I have added DataSet at design time by 'Add -> New Item -> DataSet -> DataSet1.xsd'<br>
  So, I have all the required tables along with their 1:1 or 1:M relations.</p>
  
  <p>I have applied some filter on main table adapter so that only selected records from parent table and their related child records are populated in the dataset. And finally, I want to write this data from DataSet to Xml file.</p>
  
  <p>But, I am getting one issue - the final dataset that I am getting is having all the records from child table. Instead it should have only those child records for which parent table is having related records.</p>
  
  <p>I am using following code - </p>
  
  <pre><code>ParentDataSet parentDataSet = new ParentDataSet();
   ParentTableAdapter parentTableAdapter = new ParentTableAdapter();
   parentTableAdapter.Fill(parentDataSet.ParentTable, column1Value); // All fine until here as I have applied filter in tableAdapter SQL
  
   ChildTableAdapter childTableAdapter = new ChildTableAdapter();
   //returns all rows in the child table -- shouldn't it return only those child records for which parent dataset table is having records??
   childTableAdapter.Fill(parentDataSet.ChildTable);  
  
   parentDataSet.WriteXml(xmlFilePath);
  </code></pre>
  
  <p>Please guide what I am missing here?</p>
  
  <p>Thank you!</p>