Biljana Biljana - 6 months ago 19
SQL Question

How to convert SQL Query to Lambda Expression

Here is my SQL Query:

SELECT
UserName,
IsApproved
FROM aspnet_Users u
INNER JOIN aspnet_Membership m
ON u.UserId = m.UserId


Can anybody help me how to write with lambda expression?

Answer

Try this..

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