2016-05-17 80 views

回答

0

試試這個..

from u in context.aspnet_Users 
join m in context.aspnet_Membership on u.UserId equals m.UserId select new { u.UserName, m.IsApproved}; 
+0

如果會是這樣,將會怎樣?選擇用戶名,從aspnet_Users IsApproved ù 內上u.UserId加入aspnet_Membership米= m.UserId 其中u.UserName = @UserName – Biljana

+0

這將是,從aspnet_Users選擇u.UserName,m.IsApprovedû內部聯接aspnet_Membership米上u.UserId = m.UserId其中u.UserName = @UserName –

1
from u in aspnet_Users 
join m in aspnet_Membership on u.UserId equals m.UserId 
select new { u.UserName, m.IsApproved }; 
+0

加入ON錯過。 – valex

+0

@valex謝謝我修復 –

0

您可以使用JOIN與Lambda表達式這樣的事情,

var result = aspnet_Users 
       .Join(aspnet_Membership, 
       u => u.UserId, 
       m => m.UserId, 
       (u, m) => new 
      { 
       UserName = u.UserName, 
       IsApproved = u.IsApproved 
      } 
      ); 
0

一個怎麼樣這個查詢:

選擇用戶名, is asproved from aspnet_Users你好 inner join aspnet_Membership m on u.UserId = m.UserId 其中u.UserName = @UserName

在這種情況下,放哪裏? @UserName的是,我在 公衆的ActionResult UserActivation(用戶名字符串)定義字符串參數 { ... }

相關問題