Guest User

Untitled

a guest
Aug 11th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. How do I get the first value from this collection using Linq to Entities?
  2. using (kdEntities db = new kdEntities())
  3. {
  4. Label lbl = sender as Label;
  5. IQueryable<UserGroup> userGroups = from UserGroup in db.UserGroups where UserGroup.UgpID == 1 select UserGroup;
  6.  
  7. foreach (var group in userGroups)
  8. {
  9. lbl.Text = group.UgpDescription;
  10. }
  11. }
  12.  
  13. userGroups.FirstOrDefault();
Add Comment
Please, Sign In to add comment