Print Page | Close Window

Retreive entities with null value in a field

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=427
Printed Date: 03-May-2025 at 3:42am


Topic: Retreive entities with null value in a field
Posted By: f3rland
Subject: Retreive entities with null value in a field
Date Posted: 13-Sep-2007 at 5:49am
How to add a clause that specify DBNull?
 

Dim oResult As EntityList(Of SomeProject.Something)
Dim oQuery As New EntityQuery(GetType(SomeProject.Something))
Dim oCol As New Collection
'oCol.Add(DBNull.Value)   <----- here is the problem!
oCol.Add("**")
oCol.Add("")
oQuery.AddClause(SomeProject.Something.StringFieldThatCanBeNullEntityColumn, EQO.In, oCol) ' <----  Throw exception here
 
Thanks!



Replies:
Posted By: Linguinut
Date Posted: 13-Sep-2007 at 9:45am
Use the OQL to solve this one.  Remove the line "oCol.Add(DBNull.Value)" and add another AddClause with an OR operative.  Utilize the EntityQueryOp.IsNull parameter.



Print Page | Close Window