|
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace ExecuteSSIS
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
//
// Load package from file system
//
Package package = app.LoadPackage("c:\\ExamplePackage.dtsx", null);
package.ImportConfigurationFile("c:\\ExamplePackage.dtsConfig");
Variables vars = package.Variables;
vars["MyVariable"].Value = "value from c#";
DTSExecResult result = package.Execute();
Console.WriteLine("Package Execution results: {0}",result.ToString());
//
// Load package from Sql Server
//
Package package2 = app.LoadFromSqlServer(
"ExamplePackage","server_name", "sa", "your_password", null);
package2.ImportConfigurationFile("c:\\ExamplePackage.dtsConfig");
Variables vars2 = package2.Variables;
vars2["MyVariable"].Value = "value from c# again";
DTSExecResult result2 = package2.Execute();
Console.WriteLine("Package Execution results: {0}",
result2.ToString());
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.