0

私が持っているストアド プロシージャと同等の linq ステートメントを作成しようとしています。私が持っているものは結果を返さないので、どこかが間違っているに違いないと思います。

私がこれまでに持っているもの

from r in context.View
where ValOne== null ? false : r.ColOne.Equals(ValOne) && 
      ValTwo == null ? false : r.ColTwo.Equals(ValTwo) && 
      (r.ODate >= Start && r.ODate <= End) 
select r

linqに変更したいもの

select * from View
Where (@ValOne is null or ColOne = @ValOne)
  and (@ValTwo is null or ColTwo = @ValTwo)
  and (@Start is null or ODate between @Start and @End)
4

3 に答える 3

1
from r in context.View
where ValOne== null || r.ColOne.Equals(ValOne) && 
      ValTwo == null || r.ColTwo.Equals(ValTwo) && 
      (r.ODate >= Start || r.ODate <= End) 
select r
于 2013-08-22T14:02:51.270 に答える