On 8/30/2011 2:11 PM, kumarg1985 wrote:
> I am trying to select Null GUID's uisng linq but all i am getting is an
> empty result set.
>
> i tired all possible ways of querying it.
>
> var query = from m in datacontext.tablename where m.item_guid == null ||
> m.item_guid ==Guid.Empty || m.item_guid.ToString() == null select m;
>
> sql generated (quick watch from VS)
>
> SELECT [t0].[item_guid], [t0].[field2]
>
> FROM [dbo].[tablename] AS [t0]
>
> WHERE ([t0].[item_guid] IS NULL) OR ([t0].[item_guid] = @p0) OR
> ((CONVERT(NVarChar(MAX),[t0].[item_guid])) IS NULL)
>
> item_guid is uniquer identifier in SQLSEVER and is returning results
> when i query using 'item_guid IS NULL' in sql server.
>
I know the code I used in selecting a null value property using Linq and
EF was close to what is in the link.