SSIS 2012 C# can't recognize DTS variables

  • In my Script Component I want to access to variables. I do bellow steps.

    -Drop Script Component

    -In component editor add "System:PackageName" to ReadonlyVariables

    -Open C# script editor

    -change using to

    [Code]

    using System;

    using System.Data;

    using Microsoft.SqlServer.Dts.Runtime;

    using Microsoft.SqlServer.Dts.Pipeline;

    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

    using Microsoft.SqlServer.Dts.Runtime.Wrapper;

    [/Code]

    -add bellow line to Inpout0_ProcessInputRow routine

    [Code]

    string packageName = Dts.Variables["System::PackageName"].Value.ToString();

    [/Code]

    but on Dts with red line I get "The Name Dts dose not exist in the current contex' !!

    what should I do to recognize Dts?

    Thanks

  • In the script component there is a different syntax.

    Using Variables in the Script Component

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks I wrote as bellow code

    string packageName = this.Variables.PackageName;

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

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