How to script and modify the variables of Package connection

How to script and modify the variables of Package connection

To iterate and modify the variables used by a package, follow these steps:

  1. Create a script task.
  2. Reference CozyRoc.SSISPlus library.Add Reference
  3. In the script get reference to a package connection manager.
  4. Get connection manager InnerObject property and cast it to PackageConnectionManager.
  5. Get Variables property, which is generic Dictionary type. It contains variable name to variable value pairs. Modify this collection, to setup package connection variables.

Check the sample script below demonstrating how to access package connection variables.


1
2
3
4
5
6
Imports System.Collections.Generic
Imports CozyRoc.SqlServer.SSIS
...
Dim manager As ConnectionManager = Dts.Connections("YourPackageConnection")
Dim packageCM As PackageConnectionManager = CType(manager.InnerObject, PackageConnectionManager)
Dim packageVars As Dictionary(Of String, String) = pac

    • Related Articles

    • How to upgrade a script in Script Component Plus from 2005 to 2008

      How to upgrade a script from 2005 to 2008 In order for this process to work, you must have both SQL 2005 and 2008 installed side-by-side on the same machine. Most of the scripts published in the public script repository are for SQL 2005. However they ...
    • How to upgrade a script in Script Task Plus from 2005 to 2008

      How to upgrade your script from 2005 to 2008 In order for this process to work, you must have both SQL 2005 and 2008 installed side-by-side on the same machine. Most of the scripts published in the public script repository are for SQL 2005. However ...
    • Where can I find scripts for the Script Task Plus and Script Component Plus?

      Although no longer supported, scripts for the Script Task Plus can be found at the following link.    We are now supporting scripts for JavaScript Task and JavaScript Component instead. JavaScript Task is an SSIS Control Flow Task that allows ...
    • Where can I find the documentation for the Script Task Plus?

      You can find documentation related to all the COZYROC SSIS+ Component Suite components from the main products page.  Specific documentation for the Script Task Plus can be found at the following link.  For many of the components you can find ...
    • How to start

      Go to Toolbox and open the Choose Toolbox Items ... dialog. Press the SSIS Control Flow Items tab and select Script Task Plus. Drag Script Task Plus into your control flow package and open the Design Script IDE. Add a reference in the script project ...