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 6175 posts 24176 karma points MVP 8x 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 . 

     

Please Sign in or register to post replies

Write your reply to:

Draft