开发者

Subsonic3 Where "OR" clause linq query

开发者 https://www.devze.com 2022-12-10 06:00 出处:网络
I\'m trying to figure out how to do a query with a where blah=blah or blah=blah2 with subsonic 3 开发者_开发技巧linq and I can\'t figure it out. My query at the moment looks like this:

I'm trying to figure out how to do a query with a where blah=blah or blah=blah2 with subsonic 3 开发者_开发技巧linq and I can't figure it out. My query at the moment looks like this:

var ddFaxNumbers = from f in rf_faxnumber.All().Where(f => f.assigned == null).Where(f => f.location == currentFaxNumberRecordData.location)
                               select f;

This is a page with an update panel where when the user clicks edit I display 2 dropdowns, one for location, and one for the phone numbers. The current phone number is assigned, and marked so in the database table, so when I try to bind the dropdown it throws an error since the results don't contain the currently assigned number. I need to be able to query the table like so:

select * from numbers where assigned == null or number == currentnumber and location=selecteLocation. What I can't figure out in the SS syntax is how to do the OR part of the query. I don't see an .or, so is this even possible? Thanks for your help in advance.

Jon


You should be able to just do:

var ddFaxNumbers = from f in rf_faxnumber.All()
                   where (f.assigned == null || f.location == currentFaxNumberRecordData.location) 
                   select f;
0

精彩评论

暂无评论...
验证码 换一张
取 消