日期:2014-05-17 浏览次数:20538 次
var linq = from tb1 in dt1.AsEnumerable()
join tb2 in dt2.AsEnumerable()
on new { id = tb1.Field<string>("ProductID"), time = tb1.Field<string>("Time") } equals new { id = tb2.Field<string>("ProductID"), time = tb2.Field<string>("Time") } into des
from tb2 in des.DefaultIfEmpty()
select new { product = tb1.Field<string>("ProductID"), number = tb1.Field<int>("Number") + (tb2 == null ? 0 : tb2.Field<int>("Number")), money = tb1.Field<decimal>("Money") + (tb2 == null ? 0 : tb2.Field<decimal>("Money")) };
foreach (var l in linq)