none
Execute DTSx in visual studio 2019 RRS feed

  • Question

  • Hi 

    I new in SSIS .

    I have a problem with execute a package (DTSx) in Visual Studio C# 2019

    I follwed the instructions in the microsoft help page but  I didn't succeed.

    I have questions about parameters.

    folderName

    projectName

    And how to use  

     Catalog catalog = integrationServices.Catalogs["SSISDB"];

    Can somebody help me, please?

     string targetServerName = "localhost";
                string folderName = "Project1Folder";
                string projectName = "Integration Services Project1";
                string packageName = "Package.dtsx";
    
                // Create a connection to the server
                string sqlConnectionString = "Data Source=" + targetServerName +
                    ";Initial Catalog=master;Integrated Security=SSPI;";
                SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);
    
                // Create the Integration Services object
                IntegrationServices integrationServices = new IntegrationServices(sqlConnection);
    
                // Get the Integration Services catalog
                Catalog catalog = integrationServices.Catalogs["SSISDB"];
    
                // Get the folder
                CatalogFolder folder = catalog.Folders[folderName];
    
                // Get the project
                ProjectInfo project = folder.Projects[projectName];
    
                // Get the package
                PackageInfo package = project.Packages[packageName];
    
                // Run the package
                package.Execute(false, null);
    
            }
        }


    Friday, December 13, 2019 4:13 PM

All replies

  • Hi AntonioER,

    To execute ssis package using C#, we can follow the following steps:

    1. Add a reference to the SSIS namespaces.
    2. Connect to the SSIS catalog using a connection to msdb. Point to the Catalog and Folder where the packages have been deployed.
    3. Set up any parameters that you will pass the child package. You will set up this code block for each parameter.
    4. Decide whether you want the package to run Synchronously or Asynchronously. By default, the Execute is Asynchronous. Set the SYNCHRONIZED Boolean parameter to update this value.
    5. Add each parameter to a parameter set.
    6. Execute the package and return the SSIS Catalog Execution ID. This execution_id will join to the SSISDB.catalog.executions.

    Please refer to How to Execute a SSIS Package within a SSIS Script Task.

    Best Regards,

    Mona


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, December 16, 2019 5:19 AM
  • Hi,

    May I know if you have anything to update?

    Please remember to click "Mark as Answer" the responses that resolved your issue. 

    This can be beneficial to other community members reading this thread.

    Best Regards,

    Mona


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, December 19, 2019 9:51 AM