以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  分页加载  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=106022)

--  作者:huhu
--  发布时间:2017/8/31 12:06:00
--  分页加载
afterload代码如下。
如果加上红色的代码,第一次打开窗口目录树创建正确,可是再次打开窗口目录树就创建不对了,少了不少,感觉只把加载的第一页创建了。
如果把红色代码注释掉,每次打开窗口目录树创建都正确。这怎么解决?
If user.IsRole("测试部经理") Then
    DataTables("BUG录入表").LoadFilter =""
    DataTables("BUG录入表").Load
    Tables("BUG录入表").sort = "BUG_ID DESC"
    Dim cnt As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","[严重程度] = \'死机\' And (状态 = \'待解决\' or 状态 = \'未解决\')")
    e.Form.Controls("超严重BUG").text = "超严重BUG(" & cnt & ")"
    Dim cnt11 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","[优先级别] = \'立刻(Immediate)\' And (状态 = \'待解决\' or 状态 = \'未解决\')")
    e.Form.Controls("超紧急BUG").text = "超紧急BUG(" & cnt11 & ")"
    Dim Page As WinForm.TopicPage
    Dim cnt1 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = \'待解决\' and 提交人邮箱 = \'" & user.name & "\'")
    Dim cnt2 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = \'已更新\'  and 提交人邮箱 = \'" & user.name & "\'")
    Dim cnt3 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = \'已解决\'  and 提交人邮箱 = \'" & user.name & "\'")
    Dim cnt4 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","状态 = \'未解决\'  and 提交人邮箱 = \'" & user.name & "\'")
    Dim cnt5 As Integer = DataTables("BUG录入表").SQLCompute("Count(BUG_ID)","提交人邮箱 = \'" & user.name & "\'")
    Page = e.Form.Controls("TopicBar1").Pages.Add("测试部BUG统计","测试部BUG统计")
    Page.Links.Add("待解决的BUG","待解决的BUG(" & cnt1 & ")" )
    Page.Links.Add("待验证的BUG","待验证的BUG(" & cnt2 & ")" )
    Page.Links.Add("已解决的BUG","已解决的BUG(" & cnt3 & ")" )
    Page.Links.Add("未解决的BUG","未解决的BUG(" & cnt4 & ")" )
    Page.Links.Add("部组个和BUG","部组个和BUG(" & cnt5 & ")" )
    Dim t1 As WinForm.TreeView = e.Form.Controls("TreeView1")
    t1.BuildTree("BUG录入表","测试组名|提交人","测试部门 = \'测试部部门\'")
    t1.Nodes.Insert("显示测试部门所有测试人员提交的BUG",0)
    Dim t2 As WinForm.TreeView = e.Form.Controls("TreeView2")
    t2.CreateTree("BUG录入表","怀疑模块","","测试部门 = \'测试部部门\'")
    t2.Nodes.Insert("显示测试部门所有模块的BUG",0)
    Dim t3 As WinForm.TreeView = e.Form.Controls("TreeView3")
    t3.CreateTree("BUG录入表","测试机型","","测试部门 = \'测试部部门\'")
    t3.Nodes.Insert("显示测试部门所有机型的BUG",0)
    Dim t4 As WinForm.TreeView = e.Form.Controls("TreeView4")
    t4.CreateTree("BUG录入表","测试项目名称","","测试部门 = \'测试部部门\'")
    t4.Nodes.Insert("显示测试部门所有项目的BUG",0)
    Dim t5 As WinForm.TreeView = e.Form.Controls("TreeView5")
    t5.CreateTree("BUG录入表","软件版本","","测试部门 = \'测试部部门\'")
    t5.Nodes.Insert("显示测试部门所有环境的BUG",0)
End If

With DataTables("BUG录入表")
    .LoadOver = "BUG_ID"
    .LoadReverse=True
    .LoadTop =  22
    .LoadPage =  0
    .Load()
    If .TotalPages = 0 Then
        .LoadPage = 0
        e.Form.Controls("TextBox1").Value = .LoadPage  & "/" & .TotalPages
    Else
        e.Form.Controls("TextBox1").Value = .LoadPage + 1  & "/" & .TotalPages
    End  If
End  With

--  作者:有点甜
--  发布时间:2017/8/31 12:08:00
--  

生成目录树的代码有问题。请使用后台方式生成,如

 

Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT 产品,客户 From {订单}"
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt,"产品|客户")
trv.Nodes.Insert("加载所有数据",0)


--  作者:huhu
--  发布时间:2017/8/31 13:10:00
--  
Dim cmd As New SQLCommand
    cmd.Conn ecti
    Dim dt As DataTable
    cmd.CommandText = "SEL ECT DISTINCT BUG_ID From {FoxData}.{dbo}.{BUG录入表}"
    dt = cmd.ExecuteReader()
    Dim t1 As WinForm.TreeView = e.Form.Controls("TreeView1")
    t1.BuildTree(dt,"测试组名|提交人","测试部门 = \'测试部部门\'")
    t1.Nodes.Insert("显示测试部门所有测试人员提交的BUG",0)
    Dim t2 As WinForm.TreeView = e.Form.Controls("TreeView2")
    t2.CreateTree(dt,"怀疑模块","","测试部门 = \'测试部部门\'")
    t2.Nodes.Insert("显示测试部门所有模块的BUG",0)
    Dim t3 As WinForm.TreeView = e.Form.Controls("TreeView3")
    t3.CreateTree(dt,"测试机型","","测试部门 = \'测试部部门\'")
    t3.Nodes.Insert("显示测试部门所有机型的BUG",0)
    Dim t4 As WinForm.TreeView = e.Form.Controls("TreeView4")
    t4.CreateTree(dt,"测试项目名称","","测试部门 = \'测试部部门\'")
    t4.Nodes.Insert("显示测试部门所有项目的BUG",0)
    Dim t5 As WinForm.TreeView = e.Form.Controls("TreeView5")
    t5.CreateTree(dt,"软件版本","","测试部门 = \'测试部部门\'")
    t5.Nodes.Insert("显示测试部门所有环境的BUG",0)

提示列名测试组名无效
另外我想问一下,为什么后台数据库的表面前面有dbo?
[此贴子已经被作者于2017/8/31 13:11:52编辑过]

--  作者:有点甜
--  发布时间:2017/8/31 14:21:00
--  

改成

 

cmd.CommandText = "SELECT * From BUG录入表"

[此贴子已经被作者于2017/8/31 14:21:49编辑过]

--  作者:huhu
--  发布时间:2017/8/31 14:33:00
--  
现在好了。
另外我想问一下,为什么后台数据库的表面前面有dbo?
还有不应该是{BUG录入表}?大括号不要也可以?

--  作者:有点甜
--  发布时间:2017/8/31 15:08:00
--  

1、ado这个没问题的, ado.表名,前面的是用户名;

 

2、sqlserver写不写括号都没问题。