SSIS Script Component Variable Assignment Error

  • SSIS Script Component Variable Assignment Error

    Any help on the issue below would be much appreciated.

    I am, what I think, try to do a pretty simple task but having much difficulty. Within the Script Component task I am try to do the following:

    1. Read in a variable from the SSIS package

    2. Assign this variable to a variable within the script component

    3. Increment the script component variable and assign the result to each line

    Here is the code:

    Public Class ScriptMain

    Inherits UserComponent

    Dim dblRow As Double = Me.Variables("SSIS Variable")

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    Row.Key = dblRow

    dblRow += 1

    End Sub

    End Class

    The line:

    Dim dblRow As Double = Me.Variables("SSIS Variable")

    Returns the following error:

    Class 'ScriptComponent_(Lots of Letters/Numbers).Variables' cannot be indexed because it has no default property.

    Help!!!

    Thanks

  • Try:

    Dim dblRow As Double = Me.Variables("SSIS Variable").Value

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Same Result

  • Are you sure your variable is called "SSIS Variable" ? SSIS doesn't allow variables with spaces in it.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Public Class ScriptMain

    Inherits UserComponent

    Dim dblRow As Double

    Public Overrides Sub PreExecute()

    dblRow = Me.Variables.NameOfYourVariable

    MyBase.PreExecute()

    End Sub

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    Row.Key = dblRow

    dblRow += 1

    End Sub

    End Class

  • Some information on using variables in a Script Component:

    http://msdn.microsoft.com/en-us/library/aa337079%28SQL.90%29.aspx

    http://msdn.microsoft.com/en-us/library/ms136033.aspx - scroll down to the section titled "Interacting with the Package in the Script Component."

  • Erik,

    Of course you are correct. Sorry my bad.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Bingo...Erik Thanks! Also, thanks for the link to the article

    CozyRoc thanks for your help as well

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply