I have a Linq Query in my application that looks like
claim[] claimLst = (from clms in dbContext.claims where
clms.@switch == 8
&& (clms.Status == "Received Ok" || clms.Auto_Resubmit == 1)
&& ((short)clms.tiMarkedForSubmission_M == 0
|| (short)clms.tiMarkedForSubmission_T == 0)
select clms).ToArray();
When I look at it in SQL Server Profiler I can see that it gets resolved to
exec sp_executesql N'SELECT [t0].[id], [t0].[datetime_received],
[t0].[Uniqueid], [t0].[Practice_number], [t0].[regnum], [t0].[claim_number],
[t0].[Status],
[t0].[Date_time], [t0].[Action], [t0].[Med_resp], [t0].[Tar_resp], [t0].[switch],
[t0].[Auto_Resubmit], [t0].[Auto_Resubmit_Count],
[t0].[tiMarkedForSubmission_M], [t0].[tiMarkedForSubmission_T]
FROM [dbo].[claims] AS [t0]
WHERE ([t0].[switch] = @p0) AND (([t0].[Status] = @p1) OR ([t0].[Auto_Resubmit] = @p2))
AND ((([t0].[tiMarkedForSubmission_M]) = @p3)
OR (([t0].[tiMarkedForSubmission_T]) = @p4))'
,N'@p0 int,@p1 varchar(8000),@p2 int,@p3 int,@p4 int',
@p0=8,@p1='Received Ok',@p2=1,@p3=0,@p4=0
When I run this sql, I get no results. Where as when I run the query as
Select * from dbo.claims clms where
clms.switch = 8 AND
(clms.Status = 'Received Ok'
OR clms.Auto_Resubmit = 1)
AND (clms.tiMarkedForSubmission_M = 0
OR clms.tiMarkedForSubmission_T = 0)
I get 10 records.
What is different in the two queries that 1 gives me results and the other does not?