Re: Linq-To-SQL reports that the query operator 'Last' is not supported

Last post 12-03-2009 5:08 PM by francisco.leonel.jimenez. 0 replies.

Sort Posts:

  • Re: Linq-To-SQL reports that the query operator 'Last' is not supported

    8 hours, 13 minutes ago

    In my case i need the first and last element of the query result so i made this:

    ' create my query

    dim dc= new dataContext

    dim q=From x in dc.table Where x.field=True Select x

    'lets say my result contains 4 records

    ''here we get the first one :

    'assuming my field is Integer

    dim firstValue as Integer=q.First.field

    ''now lets get the last one

    dim lastValue as Integer=q.Skip(q.Count - 1).First.field


    That worked for me.

    Hope This help.

    If there is something wrong please letme know

    P.S. My friend at the office helped me with this idea.


Page 1 of 1 (1 items)