Foxtable(狐表)用户栏目专家坐堂 → [求助] 看下这样统计数据显示可以吗?


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

主题:[求助] 看下这样统计数据显示可以吗?

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


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
[求助] 看下这样统计数据显示可以吗?  发帖心情 Post By:2013/7/29 16:22:00 [显示全部帖子]

数据列表中的数据综合统计完显示在窗口当中怎么显示? 统计数据不是单一的统计,分类统计。

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目963.table


 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 8:27:00 [显示全部帖子]

谢谢!

 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 14:43:00 [显示全部帖子]

我加了几个数据后代码错误....


 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 14:45:00 [显示全部帖子]

Dim values() As String = {"终端机总数","开机","关机","仓库","中心","TPT","TPT-1","CJ3000","CP86-08","CP86-09","BCR","高1","竞2","电3","即4","副机","中心"}
Dim str As List (Of String) = DataTables("设备管理").GetUniqueValues("地区 Is Not Null","地区")
str.Add("全国")
Dim str1 As String
str1 = "Select 地区,Count(地区) As 终端机总数,Sum(IIf(状态 = '开机',1,0)) As 开机,Sum(IIf(状态 = '关机',1,0)) As 关机,"
str1 = str1 & "Sum(IIf(状态 = '仓库',1,0)) As 仓库, Sum(IIf(状态 = '中心',1,0)) As 中心,Sum(IIf(终端机_型号 = 'TPT',1,0)) As TPT,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'TPT-1',1,0)) As TPT-1,Sum(IIf(终端机_型号 = 'CJ3000',1,0)) As CJ3000,Sum(IIf(终端机_型号 = 'CP86-08',1,0)) As CP86-08,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'CP86-09',1,0)) As CP86-09,Sum(IIf(即1终端机型号 = 'BCR',1,0)) As BCR,Sum(IIf(高1= '有高1',1,0)) As 高1,"
str1 = str1 & "Sum(IIf(竞2 = '有竞2',1,0)) As 竞2,Sum(IIf(类型 = '电3',1,0)) As 电3,Sum(IIf(类型 = '即4',1,0)) As 即4,Sum(IIf(类型 = '副机',1,0)) As 副机,"
str1 = str1 & "Sum(IIf(类型 = '副机',1,0)) As 副机,Sum(IIf(类型 = '中心',1,0)) As 中心 "
str1 = str1 & " From {设备管理} Group by 地区"
Dim cmd As New SQLCommand
cmd.ConnectionName = ""
cmd.CommandText = str1

[此贴子已经被作者于2013-7-30 14:53:25编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 14:56:00 [显示全部帖子]

select 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确

 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 15:22:00 [显示全部帖子]

把重复的改了还是那样

 

Dim values() As String = {"终端机总数","开机","关机","仓库","1号终端","TPT","TPT-1","CJ3000","CP86-08","CP86-09","BCR","高1","竞2","电3","即4","副机"}
Dim str As List (Of String) = DataTables("设备管理").GetUniqueValues("地区 Is Not Null","地区")
str.Add("全国")
Dim str1 As String
str1 = "Select 地区,Count(地区) As 终端机总数,Sum(IIf(状态 = '开机',1,0)) As 开机,Sum(IIf(状态 = '关机',1,0)) As 关机,"
str1 = str1 & "Sum(IIf(状态 = '仓库',1,0)) As 仓库, Sum(IIf(状态 = '中心',1,0)) As 1号中断,Sum(IIf(终端机_型号 = 'TPT',1,0)) As TPT,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'TPT-1',1,0)) As TPT-1,Sum(IIf(终端机_型号 = 'CJ3000',1,0)) As CJ3000,Sum(IIf(终端机_型号 = 'CP86-08',1,0)) As CP86-08,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'CP86-09',1,0)) As CP86-09,Sum(IIf(即1终端机型号 = 'BCR',1,0)) As BCR,Sum(IIf(高1= '有高1',1,0)) As 高1,"
str1 = str1 & "Sum(IIf(竞2 = '有竞2',1,0)) As 竞2,Sum(IIf(类型 = '电3',1,0)) As 电3,Sum(IIf(类型 = '即4',1,0)) As 即4,Sum(IIf(类型 = '副机',1,0)) As 副机 "
str1 = str1 & " From {设备管理} Group by 地区"
Dim cmd As New SQLCommand
cmd.ConnectionName = ""
cmd.CommandText = str1


 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 15:55:00 [显示全部帖子]

Dim values() As String = {"终端机总数","开机","关机","仓库","1号终端","TPT","TPT-1","CJ3000","CP86-08","CP86-09","BCR","高1","竞2","电3","即4","副机"}
Dim str As List (Of String) = DataTables("设备管理").GetUniqueValues("地区 Is Not Null","地区")
str.Add("全国")
Dim str1 As String
str1 = "Select 地区,Count(地区) As 终端机总数,Sum(IIf(状态 = '开机',1,0)) As 开机,Sum(IIf(状态 = '关机',1,0)) As 关机,"
str1 = str1 & "Sum(IIf(状态 = '仓库',1,0)) As 仓库, Sum(IIf(状态 = '中心',1,0)) As 1号中断,Sum(IIf(终端机_型号 = 'TPT',1,0)) As TPT,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'TPT-1',1,0)) As TPT-1,Sum(IIf(终端机_型号 = 'CJ3000',1,0)) As CJ3000,Sum(IIf(终端机_型号 = 'CP86-08',1,0)) As CP86-08,"
str1 = str1 & "Sum(IIf(终端机_型号 = 'CP86-09',1,0)) As CP86-09,Sum(IIf(即1终端机型号 = 'BCR',1,0)) As BCR,Sum(IIf(高1= '有高1',1,0)) As 高1,"
str1 = str1 & "Sum(IIf(竞2 = '有竞2',1,0)) As 竞2,Sum(IIf(类型 = '电3',1,0)) As 电3,Sum(IIf(类型 = '即4',1,0)) As 即4,Sum(IIf(类型 = '副机',1,0)) As 副机 "
str1 = str1 & " From {设备管理} Group by 地区"
Dim cmd As New SQLCommand
cmd.CTabControl1").TabPages(s).AddControl(txt)
            txt.Width = 84
            If val.Contains("硬件") Then
                txt.Left = 301
                txt.Top = 24
            ElseIf val.Contains("软件") Then
                txt.Left = 301
                txt.Top = 57
            Else
                txt.Left = 119
                txt.Top = 24 + i
                i + = 33
            End If
            If s = "全国" Then
                e.Form.Controls(s & val).Text = dt.Compute("Sum(" & val & ")")
            Else
                Dim dr As DataRow = dt.Find("地区 = '" & s & "'")
                If dr IsNot Nothing Then
                    e.Form.Controls(s & val).Text = dr(val)
                End If
            End If
        Next
    Next
End If


 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/30 15:56:00 [显示全部帖子]

下面的还没好好弄呢,主要是显示统计数字的文本框的位置

 回到顶部
帅哥哟,离线,有人找我吗?
logi500
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1280 威望:0 精华:0 注册:2013/2/28 13:54:00
  发帖心情 Post By:2013/7/31 9:58:00 [显示全部帖子]

问题出在我数据表中"终端机"列下面有2个子列,要用其中的"型号"子列进行统计,但是在命令里面"终端机_型号"就出现错误


 回到顶部