hi can anyone tell me how do i put load linq query into datatable then populate into datagridview?
my codes are as follows:

Dim dt As New DataTable

            '' Create 3 typed columns in the DataTable.
            dt.Columns.Add("ConflictingPaper", GetType(String))
            dt.Columns.Add("Numberofstudents", GetType(String))
            dt.Columns.Add("AdminNo", GetType(String))
            'Dim query1 = (From a In dt3 Group Convert.ToString(a.Field(Of Integer)("PaperNo")) By AdminNo = (a.Field(Of String)("AdminNo")) Into Group Select dt.LoadDataRow(New Object() {String.Join(":", Group.ToArray()), Group.Count(), AdminNo}, False)).ToList().Count()



            Dim query = From r In dt3.AsEnumerable() Let adminno = r.Field(Of String)("AdminNo") Group r By adminno Into Group Select New With {.AdminNo = adminno, .numberofstudents = Group.Count(), .conflictingpaper = String.Join(":", Group.Select(Function(r) r.Field(Of Integer)("paperno").ToString()))}



            DataGridView3.AutoGenerateColumns = True
            DataGridView3.DataSource = query

this:

DataGridView3.AutoGenerateColumns = True
           DataGridView3.DataSource = query

doesn't work.
My data are not loading out.
anyone help me out with this? thanks!

What is the original content of dt3?

If all your tables are actually filled with data then

 DataGridView3.DataSource = query.ToList

should load your DataGridView

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.