0

我有一个查询,它返回学生在文本中得分的分数。

     Dim subjectSearch = From subSearch In DemoSchool.EssenceSubjectRegistrations Where subSearch.Session = drpSession.SelectedItem.Text _
        AndAlso subSearch.RealClass.ClassSN = findClassSN.FirstOrDefault AndAlso _
                       subSearch.SubjectCode = drpSubject.SelectedValue _
                       Select New With {.SubjectRegSN = subSearch.SubjectRegSN,
                                       .FirstName = subSearch.Student.FirstName,
                                       .Surname = subSearch.Student.Surname,
                                        .CA1 = subSearch.CA1,

                                         .CA4 = subSearch.CA4 }

上面的查询在绑定到 gridview 时会返回这样的结果。每个学生在数据库中总共有 3 条记录。

    SubjectRegSN   FirstName  Surname  CA1  CA4
     101            James       Osa     45   65
     102            James       Osa     76   98
     103            James       Osa     56   76   
     105            Fames       Dan     45   65
     106            Fames       Dan     76   98
     107            Fames       Dan     56   76  

但我想要这种性质的东西

    SubjectRegSN   FirstName  Surname  CA1  CA4 CA1  CA4 CA1  CA4
        1           James      Osa     45    65  76   98  56  76
        2           Fames      Dan     45    65  76   98  56  76

subjectSN 是要从中选择的表 EssenseSubjectRegistration 的数据库中的主键。请帮忙。

4

0 回答 0