ETL 脚本任务

Public Sub Main()
        '
        ' Add your code here
        '
        Dim sbWA As New StringBuilder
        Dim i As Integer
        Dim arWA As New Collections.ArrayList
        Dim bEOF As Boolean
        For Each r As DataRow In CType(Dts.Variables("dsWOACNBR").Value, DataSet).Tables(0).Rows
            i = i + 1
            bEOF = True
            sbWA.Append("','")
            sbWA.Append(r.Item(0).ToString + r.Item(1).ToString)

            If i Mod 100 = 0 Then
                bEOF = False
                Dim strWA As String = sbWA.ToString
                strWA = strWA.Substring(3) '...移除"','"字符,后面计算长度时需补上

                arWA.Add(strWA)

                sbWA.Remove(0, strWA.Length + 3) '...清空时需补上"','"已移除字符的计数

            End If
        Next

        If bEOF = True Then
            Dim strWA As String = sbWA.ToString
            strWA = strWA.Substring(3) '...移除"','"字符,后面计算长度时需补上

            arWA.Add(strWA)

        End If


        Dts.Variables("arWOACNBR").Value = arWA

        Dts.TaskResult = Dts.Results.Success
    End Sub

原文地址:https://www.cnblogs.com/lbnnbs/p/4781556.html