why the sql query is different on that linq query when run on c# and on vb.net?

c#, linq, vb.net

Solution

in VB, null checks are controlled with "is" keyword.

try this;

from p in Addresses where p.Address2 is nothing select p.AddressID

Problem

if I run this under c# ``` from p in Addresses where p.Address2 == null select p.AddressID ``` it generate this query ``` SELECT [t0].[AddressID] FROM [dbo].[Address] AS [t0] WHERE [t0].[Address2] IS NULL ``` if I run this under vb.net ``` from p in Addresses where p.Address2 = nothing select p.AddressID ``` it generate this query ``` SELECT [t0].[AddressID] FROM [dbo].[Address] AS [t0] WHERE [t0].[Address2] = '' ``` p.Address2 is a varchar field that accept null value why vb.net is "wrong" ?

Original source