我試圖將所有input0Buffer轉儲到txt文件,以結束我的努力,使得平坦的目標可重用,因爲我已經完成了超過100個包和每個結構以及列是不同的。將Input0Buffer寫入文本文件的SSIS腳本任務組件
我將錯誤行重定向到一個平面文件,所以在每個軟件包中手動設置它是一場噩夢,所以我想將整個輸入寫入而不指定Row.Name,它們全部放入文本文件中。
我到了只有一列的地步!這讓我瘋狂!!
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports System.IO
Imports System.Reflection
Imports System.Xml
Imports Microsoft.SqlServer.Dts.Pipeline
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Dim textWriter As StreamWriter
Private inputBuffer As PipelineBuffer
Public Overrides Sub ProcessInput(ByVal InputID As Integer, ByVal Buffer As Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer)
inputBuffer = Buffer
MyBase.ProcessInput(InputID, Buffer)
End Sub
Public Overrides Sub PreExecute()
MyBase.PreExecute()
textWriter = New StreamWriter("c:\Test4.txt", True)
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
textWriter.Close()
''
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim delim As String = ", "
Dim RowCount As Integer = 0
For RowCount = 0 To inputBuffer.ColumnCount = -1
If inputBuffer.Item(RowCount).ToString() = "" Then
inputBuffer.Item(RowCount) = String.Empty
End If
Next
textWriter.WriteLine(inputBuffer.Item(RowCount).ToString() & delim)
End Sub
End Class
任何人都可以幫助我嗎?
此問題已在MSDN上提出:http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/82639c70-1954-4c15-9f6e-2ece1c69ef78/ – JYousef 2011-04-29 19:05:44