New Posts New Posts RSS Feed: Retreive entities with null value in a field
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Retreive entities with null value in a field

 Post Reply Post Reply
Author
f3rland View Drop Down
Newbie
Newbie
Avatar

Joined: 13-Sep-2007
Location: Canada
Posts: 25
Post Options Post Options   Quote f3rland Quote  Post ReplyReply Direct Link To This Post Topic: Retreive entities with null value in a field
    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!


Edited by f3rland - 13-Sep-2007 at 6:57am
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down