Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jayakumar 2 posts 22 karma points
    Apr 17, 2014 @ 08:47
    Jayakumar
    0

    How to solve this linq query.

    hi

    My mvc Linq query asking error like this

    Error

    Sequence contains more than one element

     

    My Query This

    var emp=empInfo.AddressDetails.Single().FirstName

     

    How to solve this any one solve this.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 17, 2014 @ 10:39
    Alex Skrypnyk
    0

    Hi Jayakumar,

    Try this:

    var emp=empInfo.AddressDetails.First().FirstName
    

    And read please about Single() method ))

    http://www.dotnetperls.com/single

    Thanks

  • Jayakumar 2 posts 22 karma points
    Apr 17, 2014 @ 14:40
    Jayakumar
    0

    Hi

    Alex

    your query Repetaed single record in the first record . 

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies