![](/img/trans.png)
[英]How to display Linq to Entity query result in ASP.NET MVC view
[英]How to display LINQ lamda expression result with Join to a View using ASP.Net MVC?
我在將linq lambda表達式的結果顯示到視圖時遇到問題。
這是我的代碼:
var idSearchJoin = payoutdb.payout_transaction // your starting point - table in the "from" statement
.Join(payoutdb.payout_remittance, // the source table of the inner join
transaction => transaction.transid, // Select the primary key (the first part of the "on" clause in an sql "join" statement)
remit => remit.transid, // Select the foreign key (the second part of the "on" clause)
(transaction, remit) => new { Transaction = transaction, Remit = remit }) // selection
.Where(transactremit => transactremit.Transaction.senderRefId == searchTxt);
我在這里使用的聯接使這個問題變得復雜,所以現在我不知道如何像不使用聯接那樣將數據傳輸到視圖。
var idSearchJoin = payoutdb.payout_transaction.Include(x => x.payout_remittance).Where(x => x.payout_remittance.Any(y => y.senderRefId == searchTxt));
嘗試這個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.