tags:

views:

21

answers:

1

Hi, I need to get the details from the table using LINQ in C# and the where condition is ID and here my condition is ,if any of the column in the selected row is empty or null i need to return as False if not means True should be returned.....Cn any one help for this...Thanks in advance.

A: 

Suppose your table has the following columns: ID, Col1, Col2, Col3, Col4. You can the use the following Linq statement.

bool anyIsNull = (from row in context.Table
                  where row.ID = id
                  select (row.Col1 == null || row.Col2 == null ||
                          row.Col3 == null || row.Col4 == null).Single();
Ronald Wildenberg