I am trying to assign a value to a variable from a flat file in an SSIS package. The script i am using is below
#Region "Imports"
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
#End Region
' This is the class to which to add your code. Do not change the name, attributes, or parent
' of this class.
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Dim StartDate As String
Dim FinishDate As String
Public Overrides Sub PreExecute()
MyBase.PreExecute()
End Sub
Public Overrides Sub PostExecute()
MyBase.PostExecute()
Me.ReadWriteVariables("StartDate").Value = StartDate
Me.ReadWriteVariables("FinishDate").Value = FinishDate
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
StartDate = Row.StartDate
FinishDate = Row.FinishDate
End Sub
End Class
The problem Im having is that sometimes the fields from the flat file could be blank, when they are blank I get an error:
The type of the value being assigned to variable "User::StartDate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
Does anyone have any ideas what could be causing the error?