Abhilash JA Abhilash JA - 6 months ago 27
C# Question

error - Linq query returns true or false if Null value in the row

The DataTable 'IsActive1' field return empty value.

enter image description here

I have written Linq query,

enter image description here

But, It occured error. How can I solve this?


Write the definition of the column as bool? if you expect to be null.

myRow.Field<bool?>("IsActive1") == null ? true: myRow.Field<bool?>("Active1") ...