DataTable
或List
中。Object
的SSIS变量(例如:User::DataList
)。Destination
添加。将所有列标记为输入,并使用以下代码(Vb.net)。
List版本
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub PostExecute()
MyBase.PostExecute()
Variables.DataList = lstObject
End Sub
Dim lstObject As Collections.Generic.List(Of DataClass)
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
lstObject.Add(New DataClass With {
.CompanyName = Row.CompanyName,
.CountryName = Row.Country,
.EmployeeName = Row.EmployeeName,
.Freight = CDbl(Row.Freight)})
End Sub
End Class
Public Class DataClass
Public Property CompanyName As String
Public Property CountryName As String
Public Property EmployeeName As String
Public Property Freight As Double?
End Class
DataTable 版本
Public Class ScriptMain
Inherits UserComponent
Dim dtData As New System.Data.DataTable("dtData")
Public Overrides Sub PostExecute()
MyBase.PostExecute()
Variables.DataList = dtData
End Sub
Public Overrides Sub PreExecute()
MyBase.PreExecute()
dtData.Columns.Add("CompanyName")
dtData.Columns.Add("CountryName")
dtData.Columns.Add("EmployeeName")
dtData.Columns.Add("Freight")
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim drRow As DataRow = dtData.NewRow
drRow("CompanyName") = Row.CompanyName
drRow("CountryName") = Row.Country
drRow("EmployeeName") = Row.EmployeeName
drRow("Freight") = Row.Freight
dtData.Rows.Add(drRow)
End Sub
End Class