title: Looping through 2 datatable and adding values to third
body: <p>I have created 3 datatables</p>
  
  <pre><code>var dt1= new DataTable();
  var dt2= new DataTable();
  var dt3= new DataTable();
  </code></pre>
  
  <p>Then i loop</p>
  
  <pre><code>       foreach (DataRow row1 in dt1.Rows)
         {
            dt3.Rows.Add(row1.ItemArray);
  
             foreach (DataRow row2 in dt2.Rows)
             {
                var Id2 = row1["Id"];
                var Id1= row2["Id"];
                if (Id1 == Id2)
                {
                   dt3.rows["Name"] = "" ; // doesnt work       
                 }
             }
  
         }
  </code></pre>
  
  <p>As you can see that i loop on 2 datatables. Then in inner loop i check if the records matches. Now if the record matches then i want to update column "Name" on dt3 datatable.</p>
  
  <p>I tried using </p>
  
  <pre><code> dt3.rows["Name"] = "" ; 
  </code></pre>
  
  <p>But this doesnt work. I know the reason that its because i again need to loop on dt3 datatable and 
  assign values to column in that loop. But not sure how to do it and if there is even more better solution.  I mean we can find id in dt3 datatable and then update value. But not sure how to do it
  Is there more intelligent solution than looping on 2 table?</p>