我有以下查詢LINQ INNER JOIN - 返回兩個表
var customers = from customer in context.tblAccounts
join assoc in context.tblAccountAssociations on customer.AccountCode equals assoc.ChildCode
where customer.AccountType == "S" || customer.AccountType == "P"
select customer, assoc;
C#不喜歡 「ASSOC」 結尾。
我的錯誤信息是:
名爲「assoc命令」的局部變量不能在此範圍內聲明,因爲它會給予不同的意義「assoc命令」,這已經是一個「孩子」範圍用來表示別的東西。
我需要從兩個表中返回所有列,然後用
的foreach(在客戶VAR的客戶)
難道你不能......改變變量的名字? – GregRos
您需要返回2個單獨的對象還是需要填充客戶對象的屬性? –