Nethra Nethra - 7 months ago 59 Question

How to use IsNot in Linq

I have a dropdownlist that populates the list of Field1(Id) from Table1(Which has list of Ids) which comes from one entity framework. Table2 also have (Ids) which are from Table 1 that are already used from other entity framework. . So my current dropdownlist should display the ids from both the tables that are not used. My scenario is if one Id is selected and create button is clicked that id should not be seen again in the dropdown list.But i want to filter the values by using the below query but result of below query is not giving any values into the dropdown list. I am very new to VB.Net. Can anyone help me with this.

LINQ Query

Dim weTypeQry1 = (From x In db.Table1 _
Where x.field1 Select
x IsNot
(From y In db1.Table2
Where y.feild2 = x.field1
Select y)).ToList()


Got the Query for this..Below link helped a lot

 Dim weTaskTTQry = (From x In db1.Table1 _
                             Select x.Field1).Distinct.ToList()

Dim weTypeQry1 = db.TAble2.AsEnumerable().Where(Function(p) Not (weTaskTTQry.Contains(p.Filed2))).ToList()