我在下面创建了 Datatable,它在 Page_Load 上提供了一个 GridView
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strQuery As String = "SELECT DISTINCT setsTbl.setName, trainingTbl.t_date, userAssessmentTbl.o_id FROM userAssessmentTbl LEFT JOIN trainingTbl ON userAssessmentTbl.tt_id = trainingTbl.tt_id LEFT JOIN setsTbl ON trainingTbl.s_id = setsTbl.s_id LEFT JOIN outcomesTbl ON userAssessmentTbl.o_id = outcomesTbl.o_id WHERE UserId = @UserId ORDER BY setName, t_date DESC "
Dim cmd As New SqlCommand(strQuery)
cmd.Parameters.AddWithValue("@UserId", userString)
Dim dt As DataTable = GetData(cmd)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
目前它输出值:
SetName t_date o_id
name1 12.12.12 1
name2 13.07.12 1
name2 15.07.12 2
name3 16.07.12 4
name3 17.07.12 3
我想让我的 DataTable 下面输出不同的行,如下所示:
SetName t_date o_id
name1 12.12.12 1
name2 13.07.12 1
name3 16.07.12 4
谁能告诉我这是怎么做到的?