LINQ left outer join , Object reference not set to an instance of an object -
i trying perform left outer join on 2 data tables , getting error : object reference not set instance of object. code :
var result = datarows1 in dtinv.asenumerable() join datarows2 in dtsal.asenumerable() on datarows1.field<string>("taken_by").toupper() == null ? "" : datarows1.field<string>("taken_by").toupper() equals datarows2.field<string>("taken_by").toupper() == null ? "" : datarows2.field<string>("taken_by").toupper() lj r in lj.defaultifempty() select dtresult.loaddatarow(new object[] { datarows1.field<string>("taken_by") == null ? "": datarows1.field<string>("taken_by"), datarows1.field<int>("totalinv") == null ? 0 : datarows1.field<int>("totalinv"), datarows1.field<double>("totalamt") == null ? 0.00 : datarows1.field<double>("totalamt"), r == null ? 0 : r.field<int>("totalsal"), r == null ? 0 : r.field<double>("salamt") }, false);
Comments
Post a Comment