Question

    Public Function GetSubjectList(ci As CultureInfo, EACode As String) As IEnumerable(Of SelectListItem)
        Dim items

        Dim innerQuery = (From c In _context.TblSchoolDatas
                         Where c.EACODE = EACode And c.AnalystedStudents >= 10
                         Select (c.SubjectID)).Distinct()

        items = From s In _context.TblSubjects
                        Where innerQuery.Contains(s.SubjectID)
                        Order By s.Ordering
                        Select New SelectListItem With {.Text = s.ShortNameE, .Value = s.SubjectID}

        **items.Insert(0, New SelectListItem() With {.Text = "All", .Value = "All"})**

        Return items

    End Function

Public member 'Insert' on type 'DbQuery(Of SelectListItem)' not found. The error showed in bold, thanks

One more debug screen shot for your reference

http://i.imgur.com/GsX1NqP.png

Was it helpful?

Solution

You are trying to Insert into a LINQ expression. Try

items.ToList(); 

before

items.Insert()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top