// Name of the package to run string packageName = "Backup"; object pVarPersistStgOfHost = null;
DTS.PackageClass package = new DTS.PackageClass(); package.LoadFromSQLServer("localhost", "sa", "sa", DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection , null, null, null, packageName, ref pVarPersistStgOfHost);
try { // Execute the package Console.WriteLine("DTS Package Executing.."); package.Execute(); Console.WriteLine("DTS Package Completed");
} catch (Exception ex) { Console.WriteLine(ex.Message); }
finally { package.UnInitialize(); package = null; }
|