Foxtable(狐表)用户栏目专家坐堂 → [求助]TopicBar1和treeview


  共有2657人关注过本帖树形打印复制链接

主题:[求助]TopicBar1和treeview

帅哥哟,离线,有人找我吗?
Hyphen
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2015/9/10 17:04:00 [显示全部帖子]

以下是引用huhu在2015/9/10 16:21:00的发言:

               ......

                Dim cnt1 As Integer = DataTables("BUG研发表").SQLCompute("Count(BUG_ID)","状态 = '待解决' and [模块维护人] = '" &  t1.SelectedNode.Text & "' ")
                e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("待我解决的BUG").Text = "待我解决的BUG(" & cnt1 & ")"
                Dim cnt2 As Integer = DataTables("BUG研发表").SQLCompute("Count(BUG_ID)","状态 = '已更新' and [模块维护人] = '" &  t1.SelectedNode.Text & "' ")
                e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("我已更新的BUG").Text = "我已更新的BUG(" & cnt2 & ")"
                Dim cnt3 As Integer = DataTables("BUG研发表").SQLCompute("Count(BUG_ID)","状态 = '已解决' and [模块维护人] = '" &  t1.SelectedNode.Text & "' ")
                e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("我已解决的BUG").Text = "我已解决的BUG(" & cnt3 & ")"
                Dim cnt4 As Integer = DataTables("BUG研发表").SQLCompute("Count(BUG_ID)","状态 = '未解决' and [模块维护人] = '" &  t1.SelectedNode.Text & "' ")
                e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("我未解决的BUG").Text = "我未解决的BUG(" & cnt4 & ")"
                Dim cnt5 As Integer = DataTables("BUG研发表").SQLCompute("Count(BUG_ID)","[模块维护人] = '" &  t1.SelectedNode.Text & "' ")
                e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("我的所有的BUG").Text = "我的所有的BUG(" & cnt5 & ")"

......

看不懂你的逻辑。不过上面引用的这块代码可以这样写,应该效率会高点

 

Dim cmd As New SQLCommand'
Dim dt As DataTable'以上2句放到case和if之间


cmd.CommandText = "sele ct [状态],count(BUG_ID) as 数量 fr om {BUG研发表} where  [模块维护人] = '" & t1.SelectedNode.Text & "' gro up by 状态"
dt = cmd.ExecuteReader()

Dim linkText As String
Dim count As Integer
For Each dr As DataRow In dt.DataRows
    linkText = "我" & dr("状态") & "的BUG"
    e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links(linkText ).Text = linkText  & "(" & dr("数量") & ")"
    count = count + dr("数量")
Next
e.Form.Controls("TopicBar1").Pages("挂我名下的BUG").Links("我的所有的BUG").Text = "我的所有的BUG(" & count & ")"


 回到顶部