查询最大值时,表格中得不到数据,MessageBox.show的结果也是空,不知道哪里出现问题?
Dim tbl As Table = Tables("学生查询四")
Dim tp As Table = Tables("查询科目")
'For Each rw As Row In Tables("学生查询四").Rows
'For i As Integer = 0 To tp.Rows.Count -1
'Dim p As Integer = Tables("学生查询四").Cols(tp.Rows(i)("学科")).Index
Dim cls() As String = {"语文","数学","英语"} '指定要显示的各列
For Each cl As String In cls '逐列取值
For Each dr As DataRow In DataTables("学生查询四").DataRows '从数据表中提取数据
dr(cl & "最大") = tbl.Compute("max(cl)")
Next
MessageBox.show(tbl.Compute(cl))
Next