Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert SQL Query To Linq
Message
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01470083
Message ID:
01470094
Vues:
45
>>I could use some help converting this to linq:
>>
>>
>>SELECT u.*
>>	FROM aspnet_Users u
>>	JOIN aspnet_UsersInRoles ur ON ur.UserId = u.UserId
>>	WHERE ur.RoleId = @RoleId
>>
>>
>>
>>I have this so far:
>>
>>
>>var user = from u in dc.aspnet_Users
>>            where u.
>>            select u;
>>
>
>How about something like this...
>
>
>var query = from u in dc.aspnet_users where u.aspnet_UsersInRoles.RoleId = RoleId select u;
>
>User usr = query.FirstOrDefault();
>
>
>
>Kurt

That was close. This works:
var users = from u in dc.aspnet_Users
            from ur in u.aspnet_UsersInRoles
            where ur.RoleId == RoleID 
            select u;
Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform