title: How to loop to insert the records to a table by taking the data from two (2) other tables?
body: <p>I have 3 tables: tblDepartment, tblFunction, tblDepartmentFunction as below.
  tblDepartment having one to many with tblDepartmentFunction 
  tblFunction having one to many with tblDepartmentFunction 
  I need code C# to run a loop to insert the records to tblDepartmentFunction by taking DepartmentID (1) record from tblDepartment together taking FunctionID (1,2,3,4,5,6) of all records from tblFunction please refer the below drawing:</p>
  
  <p><img src="https://i.stack.imgur.com/cGxka.jpg" alt="Table drawing"></p>
  
  <p>Please help me to obtain the above.</p>