这是我的存储过程如何在Linq中编写 请帮帮我
ALTER PROCEDURE sample
(@LID var char(20)=null
)
As
SET NO COUNT ON;
begin
declare @err1 int
begin transaction
BEGIN
Select * from sample_table where Aid is not null and Sid is not null and @LID IS NULL OR Lid = @LID
order by SrNo1, SrNo2, SrNo3
END
答案 0 :(得分:0)
你需要这个:
var query = dbContext.DraftLOB
.Where(u => u.AssemblyId.HasValue &&
u.SessionId.HasValue &&
@LOBID == null ? true : u.LOBId == @LOBID)
.OrderBy(u => u.SrNo1)
.ThenBy(u => u.SrNo2)
.ThenBy(u => u.SrNo3)
.ToList();