以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  动态加载数据的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=148887)

--  作者:akkio99
--  发布时间:2020/4/17 17:02:00
--  动态加载数据的问题
我在项目属性或窗口设置了加载部分数据后,无法在窗口中的TOPICBAR中显示筛选值。
\'设置表设备的筛选加载
S elect Case user.Type
Case UserTypeEnum.Developer,UserTypeEnum.Administrator
Tables("设备").DataTable.LoadFilter = Nothing
Case UserTypeEnum.User
    S elect Case user.group
    Case "桩基部"
     \'DataTables("设备").LoadFilter = "[产品类别] = \'桩基检测\'"   
    Tables("设备").DataTable.LoadFilter = "[所属部门] = \'桩基部\'"   
    Case "建材部"
    Tables("设备").DataTable.LoadFilter = "[所属部门] = \'建材部\'"
    Case "环境部"
     Tables("设备").DataTable.LoadFilter = "[所属部门] =\'环境部\'"
    Case "结构部"
    Tables("设备").DataTable.LoadFilter = "[所属部门] =\'结构部\'"
    Case "路桥部"
    Tables("设备").DataTable.LoadFilter = "[所属部门] =\'路桥部\'"
    Case "管理层","管理部","报告室"
    Tables("设备").DataTable.LoadFilter = Nothing
    End S elect
End S elect
Tables("设备").DataTable.Load

‘这个是在设备表的导航窗口中的代码:
Dim Page1 As WinForm.Topicpage
Dim cnt1 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","[有效期] <= 0 and 设备状态=\'正常\'")
Dim cnt2 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","有效期 < 30 and 有效期 > 0 and 设备状态=\'正常\'")
Page1 = e.Form.Controls("TopicBar1").Pages.Add("设备检定","设备检定")
Page1.Links.Add("已过期","已过期(" & cnt1 & ")" )
Page1.Links.Add("即将过期","即将过期(" & cnt2 & ")" )

Dim Page2 As WinForm.Topicpage
Dim cnt3 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","设备状态=\'正常\'")
Dim cnt4 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","设备状态=\'停用\'")
Dim cnt5 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","设备状态=\'报废\'")
Dim cnt6 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)","设备状态 is null")

Page2 = e.Form.Controls("TopicBar1").Pages.Add("设备状态","设备状态")
Page2.Links.Add("正常","正常(" & cnt3 & ")" )
Page2.Links.Add("停用","停用(" & cnt4 & ")" )
Page2.Links.Add("报废","报废(" & cnt5 & ")" )
Page2.Links.Add("其他","其他(" & cnt6 & ")" )

Dim dh As WinForm.Form = Forms("设备导航")
dh.TimerEnabled=True
dh.TimerInterval = 10

Tables("设备").DataTable. 这个换成“datatables("设备")” 也不行。用computer也不行。大神,这是何故呢?

--  作者:akkio99
--  发布时间:2020/4/17 17:08:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:1587114211(1).png
图片点击可在新窗口打开查看
当数据加载为只有桩基部的时候,TOPICBAR中的统计数要么统计的是全部的,要么是显示为0,我想要显示的只有这个桩基部的统计数。
图片点击可在新窗口打开查看此主题相关图片如下:1587114162(1).png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2020/4/17 17:47:00
--  
dim filter as string = DataTables("设备").LoadFilter 
if filter > "" then filter = filter  & " and "
Dim cnt1 As Integer = Tables("设备").DataTable.SQLCompute("Count(设备编号)", filter & " [有效期] <= 0 and 设备状态=\'正常\'")
--  作者:akkio99
--  发布时间:2020/4/17 18:41:00
--  
cnt 值还是不会自动更新呢。图片点击可在新窗口打开查看
\'设置表设备的筛选加载
Dim bm As String
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
S elect Case user.Type
Case UserTypeEnum.Developer,UserTypeEnum.Administrator
cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备}"
Case UserTypeEnum.User
    S elect Case user.group
    Case "桩基部"
    bm = "桩基部"  
    Case "建材部"
    bm = "建材部"
    Case "环境部"
     bm ="环境部"
    Case "结构部"
    bm ="结构部"
    Case "路桥部"
    bm ="路桥部"
    Case "管理层","管理部","报告室"
    cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备}"
    End S elect

cmd.CommandText = "S ELECT DISTINCT 所属部门,所在位置 From {设备} where 所属部门=\'" & bm & "\'"
End S elect

dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt,"所属部门|所在位置")

S elect Case user.Type
Case UserTypeEnum.Developer,UserTypeEnum.Administrator
trv.Nodes.Insert("所有设备",0)
Case UserTypeEnum.User
    Select Case user.group
    Case "管理部","管理层"
    trv.Nodes.Insert("所有设备",0)
    Case Else
    \'\'
    End Select
End Select



\'设置导航
Dim Page1 As WinForm.Topicpage
Dim Page2 As WinForm.Topicpage
Dim filter As String = DataTables("设备").LoadFilter 
If filter > "" Then 
filter = filter & "and "
Dim cnt1 As Integer = DataTables("设备").SQLCompute("Count(设备编号)", filter & "[有效期] <= 0 and 设备状态=\'正常\'")
Dim cnt2 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "有效期 < 30 And 有效期 > 0 And 设备状态=\'正常\'")
Dim cnt3 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'正常\'")
Dim cnt4 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'停用\'")
Dim cnt5 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'报废\'")
Dim cnt6 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态 is null")


Page1 = e.Form.Controls("TopicBar1").Pages.Add("设备检定","设备检定")
Page1.Links.Add("已过期","已过期(" & cnt1 & ")" )
Page1.Links.Add("即将过期","即将过期(" & cnt2 & ")" )
Page2 = e.Form.Controls("TopicBar1").Pages.Add("设备状态","设备状态")
Page2.Links.Add("正常","正常(" & cnt3 & ")" )
Page2.Links.Add("停用","停用(" & cnt4 & ")" )
Page2.Links.Add("报废","报废(" & cnt5 & ")" )
Page2.Links.Add("其他","其他(" & cnt6 & ")" )
End If

Dim dh As WinForm.Form = Forms("设备导航")
dh.TimerEnabled=True
dh.TimerInterval = 60

--  作者:有点蓝
--  发布时间:2020/4/18 8:37:00
--  
这些代码放在什么事件的?

Dim Page1 As WinForm.Topicpage
Dim Page2 As WinForm.Topicpage
Dim filter As String = DataTables("设备").LoadFilter 
If filter > "" Then 
    filter = filter & "and "
End If
msgbox(filter & "[有效期] <= 0 and 设备状态=\'正常\'") \'有符合条件的数据吗
Dim cnt1 As Integer = DataTables("设备").SQLCompute("Count(设备编号)", filter & "[有效期] <= 0 and 设备状态=\'正常\'")
Dim cnt2 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "有效期 < 30 And 有效期 > 0 And 设备状态=\'正常\'")
Dim cnt3 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'正常\'")
Dim cnt4 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'停用\'")
Dim cnt5 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态=\'报废\'")
Dim cnt6 As Integer = DataTables("设备").SQLCompute("Count(设备编号)",filter & "设备状态 is null")

Page1 = e.Form.Controls("TopicBar1").Pages.Add("设备检定","设备检定")
Page1.Links.Add("已过期","已过期(" & cnt1 & ")" )
Page1.Links.Add("即将过期","即将过期(" & cnt2 & ")" )
Page2 = e.Form.Controls("TopicBar1").Pages.Add("设备状态","设备状态")
Page2.Links.Add("正常","正常(" & cnt3 & ")" )
Page2.Links.Add("停用","停用(" & cnt4 & ")" )
Page2.Links.Add("报废","报废(" & cnt5 & ")" )
Page2.Links.Add("其他","其他(" & cnt6 & ")" )