我的应用程序中有一个Linq查询,看起来像
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();
当我在SQL Server Profiler中查看它时,我可以看到它已解析为
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
当我运行这个sql时,我没有得到任何结果。 我在运行查询时的位置
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)
我得到10条记录。
两个查询有什么不同,1给我结果而另一个没有?