title: LINQ for sum data in DataView group by column results error?
body: <p>I am getting the following error:</p>
  
  <blockquote>
    <p>Specified cast is not valid</p>
  </blockquote>
  
  <p>The following row is highlighting this after error <code>row.Field&lt;DateTime&gt;("DATE")</code>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>var query = from row in _Hdt.AsEnumerable()
              group row by row.Field&lt;DateTime&gt;("DATE") into grp
              orderby grp.Key
              select new
              {
                 Date = grp.Key,
                 Sum = grp.Sum(r =&gt; r.Field&lt;decimal&gt;("KW"))
              };
  
              foreach (var grp in query)
              {
                  Console.WriteLine("{0}\t{1}", grp.Date, grp.Sum);
              }
  </code></pre>