【发布时间】:2012-06-05 03:25:57
【问题描述】:
我有以下问题
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(客户中的客户变量)
【问题讨论】:
-
难道你不能……更改变量的名称吗?
-
您需要返回 2 个单独的对象还是需要填充客户对象的属性?
标签: c# linq inner-join