ssis script component
What I have to do is taking form one folder multiple files and getting each files multiple sheets into one single sql table all have same metadata.
and i am having these errors.
[Script Component [1]] Error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100 wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr ppBufferWirePacket)
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Script Component" (1) returned error code 0x80131508. The component returned a failure code when the pipeline engine called PrimeOutput(). The
meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
Can anyone suggest me what am i supposed to do?
I have followed below link to create my package.
http://biresort.net/blogs/pedrocgd/archive/2009/08/06/stepbystep-ssis-extract-data-from-multiple-excel-worksheets.aspx
With one extra For each loop container to move into each files.
Previously i was getting at least one file I mean to say it was going into one file through all sheets and when it comes to another file it was failing but now its not doing anything.
I don't know what i changed and what should i do now?
I tried to ask on the forum with same error but it could not allowed me so i have to create new
here is my script component script
Imports System.Xml '>> ADDEDD
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Private connMgr As IDTSConnectionManager100
Private cnnXLS As OleDb.OleDbConnection
Private tablesInFile As DataTable
Public Overrides Sub PreExecute()
Dim strXLS As String = Me.Connections.ExcelConnectionManager.ConnectionString
cnnXLS = New OleDb.OleDbConnection(strXLS)
cnnXLS.Open()
tablesInFile = cnnXLS.GetSchema("Tables")
End Sub
Public Overrides Sub CreateNewOutputRows()
Dim tableInFile As DataRow
Dim intTableCount As Integer = 0
intTableCount = tablesInFile.Rows.Count
Dim excelTables As String()
Dim currentTable As String
Dim intTableIndex As Integer = 0
ReDim excelTables(intTableCount - 1)
For Each tableInFile In tablesInFile.Rows
Me.Output0Buffer.AddRow()
Me.Output0Buffer.ColSheet = tableInFile.Item("TABLE_NAME").ToString
'Me.Output0Buffer.ColDate = CDate(Mid(tableInFile.Item("TABLE_NAME").ToString, 2, 2) & "-" & CStr(IIf(Len(Month(Now).ToString) = 2, Month(Now).ToString, ("0" & Month(Now).ToString))) & "-" & Year(Now).ToString)
excelTables(intTableIndex) = currentTable
intTableIndex += 1
Next
End Sub
Public Overrides Sub ReleaseConnections()
cnnXLS.Close()
End Sub
End Class
BM19.23
October 15th, 2011 12:17pm