This is a migrated thread and some comments may be shown as answers.

Syntax for where column is null

1 Answer 48 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
S
Top achievements
Rank 1
S asked on 04 May 2012, 09:56 PM
Hi,

I am trying to write a condition where I need to return all rows in a table where a particular column is either blank or null.

I am using the following code:
     String condition;
                    condition += @" (CustomerId == """ + ItemObject.CustomerId  + @""" or CustomerId   is null)";

Its not working. Can someone help me with some syntax that I can use?

Thanks,
Maggi

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 09 May 2012, 04:57 PM
Hi Maggi,

 Are you using LINQ or OQL or plain SQL? What is the data type of the column? If you are using LINQ and it is a character column you could write something like
var q = context.YourType.Select( t => string.IsNullOrEmpty(t.FieldName))

Do let me know if this helps or else some more information on the exact use case would help in providing a more specific answer.


All the best,
Ady
the Telerik team
Follow @OpenAccessORM Twitter channel to get first the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
LINQ (LINQ specific questions)
Asked by
S
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or