请问在C#中如何创建ssis包,要求可以自己选择表,像SQLServer的一样。谢谢~

解决方案 »

  1.   

    using System;
    using Microsoft.SqlServer.Dts.Runtime;
    namespace Microsoft.SqlServer.Dts.Samples
    {
       class CreatingAPackage
       {
          Package package;
          public CreatingAPackage()
          {
             package   = new Package();
          }
       }
    }using System;
    using Microsoft.SqlServer.Dts.Runtime;
    namespace Microsoft.SqlServer.Dts.Samples
    {
    class ApplicationTests
        {
            static void Main(string[] args)
            {
                // The variable pkg points to the location of the
                // ExecuteProcess package sample that was installed with
                // the SSIS samples.
                string pkg = @"C:\Program Files\Microsoft SQL Server\90\Tools\Samples\1033\DataTransformationServices\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";            Application app = new Application();
                Package p = app.LoadPackage(pkg, null);
               // Now that the package is loaded, we can query on
               // its properties.
                int n = p.Configurations.Count;
                DtsProperty  p2 = p.Properties["VersionGUID"];
                DTSProtectionLevel pl = p.ProtectionLevel;            Console.WriteLine("Number of configurations = " + n);
                Console.WriteLine("VersionGUID = " + p2);
                Console.WriteLine("ProtectionLevel = " + pl);
            }
        }
    }