Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6173985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:40:24+00:00 2026-05-23T23:40:24+00:00

I am making a framework in SSIS to load files from configurable folders and

  • 0

I am making a framework in SSIS to load files from configurable folders and match them to a logical job in the database. In this job a package name is configured and in SSIS I execute this package in runtime.

I want to programmatically load a package configuration for this package, depending on the job loaded. SSIS SQL Server package configuration is not an option, because that loads values to this package just once in runtime for the package itself, but I want to load a specific package configuration in runtime that has been stored with the job (job has one package, but has many package configurations)….

Schematically:
folderA -> file A.1 -> job A -> load package configuration for job A -> execute package in job A.

Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:40:24+00:00Added an answer on May 23, 2026 at 11:40 pm

    I found the solution now. It is only possible by using a script task that uses the SSIS object model to create a package in runtime based on the SQL Server Application class where you can load the package by filename. After loading the package from file, I can read the configuration from file by xml or by SQL Server and add it in runtime to the child package configuration list.

    Two important notes:

    1) Parent variables are not passed to child package automatically.
    Only when an execute package task is used the parent variables are passed to the child automatically. To get this working I search the variables in runtime and write the values in it, because I know the exact variables I want to pass to each child package.

    2) When using SQL Server as a package configuration for a child package, you must also create a connection manager in runtime and add it to the connection manager collection of the package. when adding the package configuration to the child package, be sure that the name of that connection manager is part of the connection string.

    Here is the code to prove it works:

    //load the information of the job into these variables. Package is the File system deployed package on a share. Package configuration can be the package configuration in an xml file on a share, or a connection string when using SQL Server (this one is used here).
                string package = this.Dts.Variables["Package"].Value.ToString();
                string packageConfiguration = this.Dts.Variables["PackageConfiguration"].Value.ToString();
    
    
                //create a package from package factory, by file.
                Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
                Package packageToRun = app.LoadPackage(package, null);
    
                //------------------------------------------ CHILD PACKAGE VARIABLES PASSING
                packageToRun.EnableConfigurations = true;
    
                //add one extra package configuration for child package specific configuration
                Configuration config = packageToRun.Configurations.Add();
                config.Name = "MyConfig";
                config.ConfigurationType = DTSConfigurationType.SqlServer;
                config.ConfigurationString = packageConfiguration;
    
                //use the name 'MyConnectionManager' in your packageConfiguration
                ConnectionManager cm = packageToRun.Connections.Add("OleDb");
                cm.Name = "MyConnectionManager";
                //TODO: retrieve this from an environvariable to allow change in data source for DEV, QA, PROD, now temporarly fixed to this value
                cm.ConnectionString = "Data Source=.;Initial Catalog=YYYYYYYYYY;Provider=SQLNCLI10.1;Integrated Security=SSPI;";
    
                //For Parent-Child var passing, I used the technique to let all the parent variables being defined in the child packages. 
                //Other technique could be to allow the child package not define the parent variables, but then the child packages have to reference them from code
    
                //------------------------------------------  PARENT VARIABLES PASSING
                //Now check if these parent variables exist in child package and write the actual values in them
                try
                {
                    Variables vars = null;
                    VariableDispenser variableDispenser = packageToRun.VariableDispenser;
    
                    if (
                        packageToRun.Variables.Contains("User::XXXXXXXXXXXX") &&
                        )
                    {
                        packageToRun.VariableDispenser.LockForWrite("User::XXXXXXXXXXXX");
    
                        variableDispenser.GetVariables(ref vars);
    
                        packageToRun.Variables["User::XXXXXXXXXXXX"].Value = this.Dts.Variables["User::XXXXXXXXXXXX"].Value;
    
                        vars.Unlock();
    
                        packageToRun.Execute();
    
                        Dts.TaskResult = (int)ScriptResults.Success;
                    }
                    else
                    {
                        this.Dts.Events.FireError(0, string.Empty, "Child package: " + package + " has no required master variables defined or unable to unlock.", string.Empty, 0);
                    }
                }
                catch (Exception ex)
                {
                    this.Dts.Events.FireError(0, string.Empty, ex.Message, string.Empty, 0);
    
                    Dts.TaskResult = (int)ScriptResults.Failure;
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reviving this question, and making it more specific: Is there a .NET framework
I'm making small module/plugin for my future CMS/Framework. I wanted it from begining to
I am making a framework and I have this code ( conditions is an
Im making an easy application just to test the JSF framework. This is actually
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
Im making a small python script to upload files on the net. The script
I am making a small C++ framework, which contains many .h and .cpp. I
I'm making the design of a OO framework and I'm facing the following problem.
I am making a game using C# with the XNA framework. The player is
I am making a program for handheld PDAs using .net 2.0 compact framework and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.