How to express "is null" sql syntax in linq to sql -


how can express "is null" sql syntax in linq sql?

where(r => (r.level1.equals(l[1] == "" ? null : l[1])) 

in above code linq sql converts linq expression following sql not want.

@p1=null 

i want linq converted following sql

@p1 null 

how can achieve this?

try this

if (l[1] == "")     where(r => (r.level1 == null)); else     where(r => (r.level1 == l[1])); 

if use ternary operator expression evaluator find it's expression returning string, cause of it'll use = operator.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -