【发布时间】:2019-07-12 14:50:43
【问题描述】:
我正在尝试将多值列拆分为 ssis 脚本组件中的多个记录。我有一栏是演员的名字,另一栏是他们主演的电影(用逗号分隔)。现在我想拆分信息,以便每个 raw 包含演员的姓名和只有一部电影的标题。我正在使用下面的代码,但它有问题。有谁能够帮助我?
我使用我找到的代码,只是将 Input 和 Output 更改为 Cyrillic 以适应我的程序语言。
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Вход0_ProcessInputRow(ByVal Row As Вход0Buffer)
' This array would hold the single numeric values after you tokenize the input column '
Dim inputNumericValuesArray As Array
' This varibale would hold one value from the array during the loop '
Dim currentNumericValue As String
' Tokenize the NumericValues column by splitting it based on a semicolon separator '
inputNumericValuesArray = Row.ПреобразованиеданныхПреобразованиевЮникодknownForTitles.Split(","c)
' Loop on the retrieved tokens adding each in a new row '
For Each currentNumericValue In inputNumericValuesArray
' Create a new row '
Выход0Buffer.AddRow()
' Get the TaskName from the source row and assign it to the output row without any changes '
Выход0Buffer.nconst = Row.ПреобразованиеданныхПреобразованиевЮникодnconst
' Parse the current numeric value as decimal '
' and assign it to the Numeric value of the output row '
Выход0Buffer.knownForTitle = Decimal.Parse(currentNumericValue)
Next
End Sub
End Class
错误是0xC0047062。错误的完整描述如下:
Ошибка: 0xC0047062 в Заполнение name_title 1 1, Компонент скриптов [23]: System.NullReferenceException: Ссылка на объект не указывает на экземпляр объекта。
【问题讨论】:
-
What is a NullReferenceException, and how do I fix it? 的可能重复项。如果我对 Google 翻译的使用正确,我建议检查
Row.ПреобразованиеданныхПреобразованиевЮникодknownForTitles是否有值。
标签: vb.net ssis split etl script-component