How do you use the NULL criteria in a predicate expression?

Posts   
 
    
Posts: 1
Joined: 07-Sep-2007
# Posted on: 07-Sep-2007 22:25:38   

I am using VB.NET 2005, version 2.0 LLBLGen. I am trying to add the null criteria in my predicate expression. Here is a simple sql query, but how do you translate this in a predicate expression?

For example, I tried to do: bucket.PredicateExpression.AddWithOr((State.StateCode = System.DBNull.Value)), but I can see in the sql profiler that StateCode = Null, not StateCode Is Null.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Sep-2007 05:54:23   
bucket.PredicateExpression.AddWithOr((State.StateCode = System.DBNull.Value))

That is equivalent in SQL to: State.StateCode IS NULL

You can see that in the SQL generated code by LLBLGenPro tracing (ref: LLBLGenPro Help - Using generated code - Troubleshooting and Debugging).

David Elizondo | LLBLGen Support Team
Posts: 254
Joined: 16-Nov-2006
# Posted on: 09-Sep-2007 00:47:52   

I think you should be using == rather than = here