以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]查询最大值得不到数据  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=120528)

--  作者:sunion
--  发布时间:2018/6/18 20:09:00
--  [求助]查询最大值得不到数据
查询最大值时,表格中得不到数据,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

--  作者:有点甜
--  发布时间:2018/6/19 9:28:00
--  

改成

 

dr(cl & "最大") = tbl.Compute("max(" & cl & ")")