none
How to display LINQ query passed to procedure in DataGridView?

    Question

  • In VS2013 I have the following

    Public Class clsDisplayData
        Public BookName As String
        Public AuthorName As String
        Public StoryTitle As String
    End Class

    In the form I have the following in a menu click event:


            Dim StoryQuery = From SQ In DC.Stories Join AU In DC.Authors On SQ.AuthorID Equals AU.AuthorID Join BK In DC.Books On SQ.BookID Equals BK.BookID Order By SQ.Title Select New clsDisplayData With {.StoryTitle = SQ.Title, .AuthorName = AU.Name, .BookName = BK.Name}

            HandleDisplayResults(StoryQuery)

    Also in the form I have the following procedure:

        Private Sub HandleDisplayResults(TDS As IQueryable(Of clsDisplayData))
            Dim DisplayResults = From DR In TDS Select DR

            dgvData.DataSource = DisplayResults
        End Sub

    When I break at the DataGridView DataSource line and look at the DIsplayResults all of the data is there, but when I continue nothing appears in the DataGridView.

    Any ideas?

    Thursday, April 24, 2014 12:23 PM

Answers

All replies