title: Reference DataTable columns with Linq
body: <p>I am trying to join two datatables using linq</p>
  
  <pre><code>var invoices420 = dt420_.AsEnumerable();
  var invoices430 = dt430_.AsEnumerable();
  
              var query = from inv430 in invoices430
                          join inv420 in invoices420 on inv430.LinkDoc equals inv420.LinkDoc
                          orderby inv430.SID
                          select new
                  {
                      LinkDoc = inv430.LinkDoc,
                      TotalIn = Math.Round(inv430.Credit, 2),
                      TotalOut = ((inv420 == null) ? 0 : Math.Round(inv420.Debit, 2))
  
                  };
  </code></pre>
  
  <p>Joining does not seems to be a problem, but I am getting an error'System.Data.DataRow' does not contain a definition for 'LinkDoc' and no extension method 'LinkDoc' accepting a first argument of type 'System.Data.DataRow' could be found (are you missing a using directive or an assembly reference?).</p>
  
  <p>What do I have to do to reference a column in DataTable for example inv430.LinkDoc without using inv430.Field("linkdoc")?</p>
  
  <p>If I want to do a group by on result set I am thinking</p>
  
  <pre><code>var q2 = query
           .GroupBy(item =&gt; item.LinkDoc);
  
  return q2.ToArray();
  </code></pre>
  
  <p>Problem is that in q2 I dont get all the columns (linkdoc, totalin, totalout).</p>
  
  <p>Original data is</p>
  
  <pre><code>dt420_
  Linkdoc   Credit
  Invoice1  500
  Invoice2  100
  Invoice3  200
  
  dt430_
  LinkDoc   Debit
  Invoice1  100
  Invoice1  100
  Invoice2  200
  
  Result would be
  LinkDoc    TotalIn(Credit)  TotalOut(Debit)
  Invoice1   500              200
  Invoice2   100              200
  Invoice3   200              0
  </code></pre>