我有一个 SSIS 包,它现在因“索引超出数组范围”错误而失败。它发生在脚本组件任务中,但我在日志中看不到任何关于它失败的行的更多信息。这是我的脚本组件的文本,有人能看出这有什么问题吗?我没有更改包中的任何内容,它只是突然开始失败。
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
' Wrapper for web service
'Private CurrencyInfo As RetrieveExchangeRatesOutputMessageContract
' wrapper for Response from web service
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Try
Dim ws As New CurrencyExchangeWS.CurrencyExchangeWS
Dim inContract As New CurrencyExchangeWS.ExchangeRateInputDataContract
Dim msg As New CurrencyExchangeWS.RetrieveExchangeRatesInputMessageContract
Dim inContracts(1) As CurrencyExchangeWS.ExchangeRateInputDataContract
'Dim dt As Date = Now
'dt = dt.AddDays(-1)
inContract.RequestAsOfDate = Now
'inContract.RequestAsOfDate = "2011-07-18"
' IMPORTANT: You need to specify SourceCurrencyIdSpecified and TargetCurrencyIdSpecified or the service will assume these values are null.
inContract.SourceCurrencyIdSpecified = True
inContract.SourceCurrencyId = Row.CurrencyTypeId
inContract.TargetCurrencyIdSpecified = True
inContract.TargetCurrencyId = 47
inContracts(0) = inContract
msg.ExchangeRateInputCollection = inContracts
ws.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim outMsg As CurrencyExchangeWS.RetrieveExchangeRatesOutputMessageContract = ws.RetrieveExchangeRates(msg)
'Dim rate =outMsg.ExchangeRateInfoCollection(0).Rate
Dim rate As Decimal = outMsg.ExchangeRateInfoCollection(0).Rate
'Dim edate = outMsg.ExchangeRateInfoCollection(0).RequestAsOfDate
Dim edate = outMsg.ExchangeRateInfoCollection(0).RateAsOfDate
'Dim edate As DateTime
'edate = outMsg.ExchangeRateInfoCollection(0).RateAsOfDate
Row.date = edate
Row.rate = Convert.ToDecimal(1.0 / rate)
'Dim currency = outMsg.ExchangeRateInfoCollection(0).TargetCurrencyId
Catch ex As Exception
ComponentMetaData.FireError(1, ComponentMetaData.Name, ex.Message, String.Empty, 0, True)
End Try
End Sub
Public Overrides Sub PreExecute()
MyBase.PreExecute()
'
' Add your code here for preprocessing or remove if not needed
''
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
'
' Add your code here for postprocessing or remove if not needed
' You can set read/write variables here, for example:
' Me.Variables.MyIntVar = 100
''
End Sub
'Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Add your code here
'
'End Sub
End Class