2010-02-22 130 views
3

在代碼bdehind & &語法不起作用,任何想法?LINQ到實體多個WHERE子句&&

Entities ctx3 = new Entities(); 
var uniqueQuote = from quot in ctx3.Quotes.Include("aspnet_Users").Include("Enquiries") 
    where quot.Enquiries.EnquiryId == selectedEnquiryId && 
    quot.aspnet_Users.UserId == currentUserId 
    orderby quot.QuotePrice 
    select quot; 

錯誤2委託 'System.Func' 不採取 '1' 的參數C:\ LocalGarageFinder \ LocalGarageFinder \ EnquiryDetail.aspx.cs 56 33 LocalGarageFinder

+0

你什麼異常? – 2010-02-22 15:23:53

+0

委託 'System.Func ' 不採取 '1' 參數\t C:\ LocalGarageFinder \ LocalGarageFinder \ EnquiryDetail.aspx.cs \t LocalGarageFinder – Alex 2010-02-22 15:29:24

+0

無法轉換lambda表達式爲類型「串」,因爲它不是一個委託類型\t C:\ LocalGarageFinder \ LocalGarageFinder \ EnquiryDetail.aspx.cs LocalGarageFinder – Alex 2010-02-22 15:29:56

回答

3

作爲寫入的代碼是好的。如果您收到某種錯誤,請告訴我們。

3

如果EnquiryId或UserId是Nullable類型,將會出現錯誤。使用EnquiryId.Value == selectedEnquiryId或UserId.Value == currentUserId