IntegrationServices Only Runs Part of SSIS Package

243 views Asked by At

I have a SSIS Package that looks like this:

enter image description here

It runs fine via Visual Studio or DTEXEC in command line. I have deployed it, as seen here:

enter image description here

When I connect to and run it via C# in my WinForm it only seems to run the 'Truncate Table' task. I comes back and says it was Successful, but it only ran part of the package, which I DO NOT call Successful.

Here is the code I'm using to connect and run:

// Create a connection to the server
string sqlConnectionString = "Data Source=BSQL_01;Initial Catalog=master;Integrated Security=SSPI;";
SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);
MessageBox.Show("Created Connection");
// Create the Integration Services object
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);

// Get the Integration Services catalog
Catalog catalog = integrationServices.Catalogs["SSISDB"];
MessageBox.Show("Created Catalog");

// Get the folder
CatalogFolder folder = catalog.Folders["PORGImport"];
MessageBox.Show("Created Folder");

// Get the project
ProjectInfo project = folder.Projects["PORGImport"];
MessageBox.Show("Created Project");

// Get the package
PackageInfo package = project.Packages["PORGImport.dtsx"];
MessageBox.Show("Created Package");

// Run the package
long executionIdentifier = package.Execute(false, null);

ExecutionOperation executionOperation = integrationServices.Catalogs["SSISDB"].Executions[executionIdentifier];

while (!executionOperation.Completed) {
    System.Threading.Thread.Sleep(5000);
    executionOperation.Refresh();
    MessageBox.Show("Running...");
}

if (executionOperation.Status == Operation.ServerOperationStatus.Success) {
    Console.WriteLine("Success");
    MessageBox.Show("Success");

} else if (executionOperation.Status == Operation.ServerOperationStatus.Failed) {
    Console.WriteLine("Failed");
    MessageBox.Show("Failed");

} else {
    Console.WriteLine("Something Went Really Wrong");
    MessageBox.Show("Oh Crap");
}

I looked in the package on the SQL Server and I see this error:

Purchase File Loop: Warning: The For Each File enumerator is empty. The For Each File enumerator did not find any files that matched the file pattern, or the specified directory was empty.

Which doesn't make sense to me since it's all running from my PC, I have access to the directory, it runs fine via command line and via Visual Studio.

Environment

  • MS SQL Server 2014 (v12.0.5546.0)
  • MS Visual Studio 15 (v14 Update 3)
1

There are 1 answers

3
Hadi On

Check that Variables values are assigned

From the screenshots, it looks like you are using expressions in the for each loop container since the fx mark is shown on the top left corner. Make sure you have assigned the variable before executing the packages.