移动开发中 获取统计数据页面费时,且在打开页面时,服务器端会宕机,有没有办法提高效率呢?
页面代码如下:
Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim cmd111 As New SQLCommand
cmd111.C '记得设置数据源名称
cmd111.CommandText = "Sel ect * From {表彰}"
Dim dt As DataTable = cmd111.ExecuteReader
Dim zbmcs As List(Of String)
zbmcs=dt.GetValues("登记单位")
wb.AddPageTitle("","pageheader","表彰数据","专为管理信息化设计")
With wb.AddPanelGroup("","pg1","【" & e.Cookies("单位名称") & "】全部表彰数据")
Dim txt11 As String = "【个人表彰】" & dt.sqlcompute("count(获奖者)"," 表彰类别='个人表彰'") & "人,【集体表彰】 " & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'") & " 人."
Dim txt111 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","获奖等级='国家级'") & "人,"
Dim txt211 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","获奖等级='省部级'") & "人,"
Dim txt311 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","获奖等级='地州级'") & "人,"
Dim txt411 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","获奖等级='县市级'") & "人,"
With .Add("pn1","【表彰概况】",txt11 & txt111 & txt211 & txt311 & txt411,"")
.Badge= dt.sqlcompute("count(获奖者)")
End With
Dim txt1 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='国家级'") & "人,"
Dim txt2 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='省部级'") & "人,"
Dim txt3 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='地州级'") & "人,"
Dim txt4 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='县市级'") & "人,"
With .Add("pn1","【个人表彰】", txt1 & txt2 & txt3 & txt4,"")
.Badge= dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'")
End With
Dim txt12 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='国家级'") & "人,"
Dim txt22 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='省部级'") & "人,"
Dim txt32 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='地州级'") & "人,"
Dim txt42 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='县市级'") & "人,"
With .Add("pn1","【集体表彰】", txt12 & txt22 & txt32 & txt42,"")
.Badge= dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'")
End With
End With
For i As Integer = 0 To zbmcs.Count -1
With wb.AddPanelGroup("",zbmcs(i),"【" & zbmcs(i) & "】表彰情况:")
Dim txt11 As String = "【个人表彰】" & dt.sqlcompute("count(获奖者)"," 表彰类别='个人表彰'and 登记单位='" & zbmcs(i) & "'") & "人,【集体表彰】 " & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 登记单位='" & zbmcs(i) & "'") & " 人."
Dim txt111 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","获奖等级='国家级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt211 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","获奖等级='省部级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt311 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","获奖等级='地州级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt411 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","获奖等级='县市级'and 登记单位='" & zbmcs(i) & "'") & "人,"
With .Add("pn1","【表彰概况】",txt11 & txt111 & txt211 & txt311 & txt411,"")
.Badge= dt.sqlcompute("count(获奖者)","登记单位='" & zbmcs(i) & "'")
End With
Dim txt1 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='国家级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt2 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='省部级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt3 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='地州级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt4 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 获奖等级='县市级'and 登记单位='" & zbmcs(i) & "'") & "人,"
With .Add("pn1","【个人表彰】", txt1 & txt2 & txt3 & txt4,"")
.Badge= dt.sqlcompute("count(获奖者)","表彰类别='个人表彰'and 登记单位='" & zbmcs(i) & "'")
End With
Dim txt122 As String ="【国家级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='国家级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt222 As String ="【省部级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='省部级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt322 As String ="【地州级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='地州级'and 登记单位='" & zbmcs(i) & "'") & "人,"
Dim txt422 As String ="【县市级】" & dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 获奖等级='县市级'and 登记单位='" & zbmcs(i) & "'") & "人,"
With .Add("pn1","【集体表彰】", txt122 & txt222 & txt322 & txt422,"")
.Badge= dt.sqlcompute("count(获奖者)","表彰类别='集体表彰'and 登记单位='" & zbmcs(i) & "'")
End With
End With
Next
With wb.AddButtonGroup("","btg2", False)
.Add("btn2", "返回首页","", "default.htm")
End With
e.WriteString(wb.Build) '生成网页