C# IntegrationServices仅运行SSIS包的一部分
我有一个SSIS包,看起来像这样: 它通过命令行中的VisualStudio或DTEXEC运行良好。我已经部署了它,如下所示: 在WinForm中,当我连接到并通过C#运行它时,它似乎只运行“Truncate Table”任务。我回来说它成功了,但它只运行了包的一部分,我不称之为成功 以下是我用来连接和运行的代码:C# IntegrationServices仅运行SSIS包的一部分,c#,sql-server,ssis,ssis-2014,C#,Sql Server,Ssis,Ssis 2014,我有一个SSIS包,看起来像这样: 它通过命令行中的VisualStudio或DTEXEC运行良好。我已经部署了它,如下所示: 在WinForm中,当我连接到并通过C#运行它时,它似乎只运行“Truncate Table”任务。我回来说它成功了,但它只运行了包的一部分,我不称之为成功 以下是我用来连接和运行的代码: // Create a connection to the server string sqlConnectionString = "Data Source=BSQL_01;In
// 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");
}
我查看了SQL Server上的包,发现以下错误:
购买文件循环:警告:For Each File枚举数为空。
For Each文件枚举器未找到任何与
文件模式,或指定的目录为空
这对我来说没有意义,因为它都是从我的PC上运行的,我可以访问目录,它可以通过命令行和Visual Studio正常运行
环境
- MS SQL Server 2014(v12.0.5546.0)
- MS Visual Studio 15(v14更新3)
fx
标记显示在左上角。确保在执行包之前已分配变量
fx
标记显示在左上角。确保在执行包之前已分配变量