以下是引用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 & ")"