LINQ not checking for null?

You should be comparing to DBNull. Value not null.

You should be comparing to DBNull. Value, not null: TUITIONCurr = g . Where(p =>!object.

Equals(p. Field("TUITION"), DBNull. Value)) .

Average(p => p. Field("TUITION")); Once you've filtered out nulls, you don't need the DefaultIfEmpty() call.

TUITIONCurr = g. Where(p =>!object. Equals(p.

Field("TUITION"), DBNull. Value)).DefaultIfEmpty(). Average(p => p.

Field("TUITION")) returns the same original error – sammarcow Aug 18 '11 at 14:30 In that case, it means one of the p's is actually null; not sure why that would be, but you should assign g.ToList() to a variable and inspect it in the debugger to see what's actually in the sequence. – dlev Aug 18 '11 at 14:47.

Instead of the DataRow. Field method, try using DataRow.IsNull. Also, you don't need the call to DefaultIfEmpty().E.g.

: TUITIONCurr = g . Where(p =>!p. IsNull("TUITION")) .

Average(p => p. Field("TUITION")).

If my answer is technically incorrect, I would like to be made aware. – Donut Aug 18 '11 at 14:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send