Trouble with Script Component Variable reference

  • I am using a script component within a dataflow. In the preExecute sub I am trying to reference a variable using the format :

    dts.variables("VarName").value.tostring

    This same format works fine in a Script Task. The namespaces between the Task and Component are the same. The only difference is in the Script Task there is a reference to sqlserver.ScriptTask. There is no reference available for script component. I don't think this has anything to do with variable references.

    The component is setup as a destination.

    Namespaces:

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    Imports System.Xml

    Imports Microsoft.SqlServer.Dts.Runtime

    Error:

    Name "dts" not declared

    I'm looking for the correct method to reference a package variable in a Script Component.

  • Try this:

    Me.ReadOnlyVariables("varname").Value

    You will also need to add the variable to the ReadOnlyVariables or ReadWriteVariables in the Script Component properties of course.

  • Thanks that did the trick!

Viewing 3 posts - 1 through 2 (of 2 total)

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