Linq where column == (null reference) not the same as column == null
Change where (s.crmc_Retail_Trade_Id == tradeId) to where (s.crmc_Retail_Trade_Id == tradeId || (tradeId == null && s.crmc_Retail_Trade_Id == null)) Edit – based on this post by Brant Lamborn, it looks like the following would do what you want: where (object.Equals(s.crmc_Retail_Trade_Id, tradeId)) The Null Semantics (LINQ to SQL) MSDN page links to some interesting info: LINQ to … Read more