Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am running below linq query..

What I have tried:

C#
var query1 = ((TacdisCFContext)Db).VEHICLE_CUSTOMERS_TELE
                .Where(p => object.Equals(p.VCU_VEH_ID, null));


it is creating the below query.

{SELECT
NULL AS "C1",
NULL AS "C2",
NULL AS "C3",
NULL AS "C4",
NULL AS "C5",
NULL AS "C6",
NULL AS "C7",
NULL AS "C8"
FROM ( SELECT 1 FROM DUAL ) "SingleRowTable1"
WHERE (1 = 0)}

Can any one please help why it showing null columns.. I should be able to see column name..

Thanks...
Posted
Updated 25-Nov-16 0:41am
Comments
Maciej Los 17-Dec-16 18:10pm    
Shouldn't be: Where(p => p.VCU_VEH_ID==null)?

1 solution

It looks like it has decided your query can never return anything so it is creating a query that simply returns an empty row. Probably due to your object.Equals statement. Google "linq select where null" and you'll find the correct syntax for selecting where something is null.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900