Foxtable(狐表)用户栏目专家坐堂 → [求助]统计字符数量


  共有3099人关注过本帖平板打印复制链接

主题:[求助]统计字符数量

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/2 12:29:00 [只看该作者]

Dim dic As new Dictionary(of String, Integer)
For Each r As DataRow In e.DataTable.DataRows
    For Each cname As String in "第一列,第二列,第三列".split(",")
        If r.Isnull(cname) = False Then
            If dic.ContainsKey(r(cname)) = False Then
                dic.Add(r(cname), 1)
            Else
                dic(r(cname)) += 1
            End If
        End If
    Next
Next
For Each key As String In dic.Keys
    Dim fdr As DataRow = DataTables("表B").find("第一列 = '" & key & "'")
    If fdr Is Nothing Then
        fdr = DataTables("表B").addnew
        fdr("第一列") = key
    End If
    fdr("第三列") = dic(key)
Next


 回到顶部
总数 32 1 2 3 4 下一页