Foxtable(狐表)用户栏目专家坐堂 → [求助]请教关于表列标题的问题


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

主题:[求助]请教关于表列标题的问题

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


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2014/2/6 10:32:00 [显示全部帖子]

If DataTables.Contains("动态表列") = False Then
    Dim Builder As New ADOXBuilder
    Dim tbl As ADOXTable
    Builder.Open()
    tbl = Builder.NewTable("动态表列") '创建表
    With tbl
        For Each r As Row In Tables("表A").Rows
            If r("证书编号") > "" Then
                .AddColumn(r("证书编号") ,ADOXType.String, 16)
            End If
        Next
    End With
    Builder.AddTable(tbl) '增加表
    Builder.Close()
    Syscmd.Project.Open(ProjectFile)
Else
    Dim str1,str2 As String
    For Each r As Row In Tables("表A").Rows
        If r("证书编号") > "" Then
            str1 + = r("证书编号") & "|"
        End If
    Next
    For Each dc As DataCol In DataTables("动态表列").DataCols
        str2 + = dc.Name & "|"
    Next
    If str1 <> str2 Then
        Dim Builder As New ADOXBuilder
        Builder.Open() '打开ADOXBuilder
        With Builder.Tables("动态表列")
            For Each r As Row In Tables("表A").Rows
                If r("证书编号") > "" AndAlso str2.Contains(r("证书编号")) = False Then
                    .AddColumn(r("证书编号") ,ADOXType.String, 16)
                End If
            Next
            For Each s As String In str2.Trim("|").Split("|")
                If str1.Contains(s) = False Then
                    With Builder.Tables("动态表列")
                        .DeleteColumn(s)
                    End With
                End If
            Next
        End With
        Builder.Close() '关闭ADOXBuilder
        Syscmd.Project.Open(ProjectFile)
    End If
End If

 回到顶部