none
System.IndexOutOfRangeException: Index was outside the bounds of the array.

    Question

  • Hi i have a parent package and a child package. Child package loads multiple text files into sql table. There are around 30 text files. it loads some of the text files but for coulple of files it throws an error as below. its showing an error at custom script component(named "Get Columns"). i am trying to figure out what is this error but its hard to understand. all the fields in my sql table are nullable.  all text files have same format.

    Error: 0xC0047062 at Load File, Get Columns [10916]: 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.ProcessInput(Int32 inputID, PipelineBuffer buffer)

    Error: 0xC0047022 at Load File, DTS.Pipeline: The ProcessInput method on component "Get Columns" (10916) failed with error code 0x80131508. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
    Error: 0xC0047021 at Load File, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0x80131508.


    Tuesday, June 21, 2011 5:39 PM

Answers

  • Add something like a MessageBox to show the length of the array. Example: MsgBox(stSplit.Length())

    The Index out of range suggests that the array isn't 22 items long.

     


    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com

     


    • Marked as answer by JoJo_1 Wednesday, June 22, 2011 2:16 AM
    Tuesday, June 21, 2011 6:21 PM
    Moderator

All replies

  • Show us your code...
    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
    Tuesday, June 21, 2011 5:55 PM
    Moderator
  • The following code i have in Script Component.

       Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
            '
            Dim stSplit As String() = Row.Column0.Split(CChar(","))
            Row.SpapCode = stSplit(0).Replace(Chr(34), "")
            Row.ProgramType = stSplit(1).Replace(Chr(34), "")
            Row.Ssn = stSplit(2).Replace(Chr(34), "")
            Row.LastName = stSplit(3).Replace(Chr(34), "")
            Row.FirstName = stSplit(4).Replace(Chr(34), "")
            Row.MiddleInitial = stSplit(5).Replace(Chr(34), "")
            Row.EffectiveDate = stSplit(6).Replace(Chr(34), "")
            Row.TerminationDate = stSplit(7).Replace(Chr(34), "")
            Row.BilledAmount = stSplit(8).Replace(Chr(34), "")
            Row.SubsidyAmount = stSplit(9).Replace(Chr(34), "")
            Row.LepAmount = stSplit(10).Replace(Chr(34), "")
            Row.TotalPremium = stSplit(11).Replace(Chr(34), "")
            Row.CoveragePeriod = stSplit(12).Replace(Chr(34), "")
            Row.CarrierName = stSplit(13).Replace(Chr(34), "")
            Row.ErrorCodes = stSplit(14).Replace(Chr(34), "")
            Row.CopayCategory = stSplit(15).Replace(Chr(34), "")
            Row.SubsidyLevel = stSplit(16).Replace(Chr(34), "")
            Row.GroupNum = stSplit(17).Replace(Chr(34), "")
            Row.Hicn = stSplit(18).Replace(Chr(34), "")
            Row.ContractCodePaid = stSplit(19).Replace(Chr(34), "")
            Row.PbpPaid = stSplit(20).Replace(Chr(34), "")
            'Row.InvoiceNum = stSplit(21).Replace(Chr(34), "")
            '

            'Set Default to RateDataArea
            If Trim(Row.SubsidyLevel) = "" Or IsNothing(Row.SubsidyLevel) Then
                Row.SubsidyLevel = "000"
            End If

    Tuesday, June 21, 2011 5:57 PM
  • Add something like a MessageBox to show the length of the array. Example: MsgBox(stSplit.Length())

    The Index out of range suggests that the array isn't 22 items long.

     


    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com

     


    • Marked as answer by JoJo_1 Wednesday, June 22, 2011 2:16 AM
    Tuesday, June 21, 2011 6:21 PM
    Moderator