Aracılığıyla paylaş


Veri akışı bileşenleri programsal olarak bağlanma

Bileşenleri ekledikten sonra veri akışı görevi, hedefe dönüştürmeleri aracılığıyla kaynaklardan veri akışını temsil eden bir yürütme ağacı oluşturmak için bunları bağlayın.Kullandığınız IDTSPath100 veri akışı bileşenlerinde bağlanmak için nesneler.

Bir yol oluşturma.

Call New yöntem PathCollection() özellik MainPipe Yeni bir yol oluşturmak ve veri akışı görevi yolların koleksiyonuna eklemek için arabirim'ı tıklatın. Bu yöntem, yeni bir sayı, bağlantısı kesik IDTSPath100 Nesne, sonra iki bileşen bağlanmak için kullanabilir.

Call AttachPathAndPropagateNotifications(IDTSOutput100, IDTSInput100) yöntem yol ve yolun, bağladıktan, katılan bileşenlerin bildirir. Bu yöntem kabul eden bir IDTSOutput100 Geliş yönündeki bileşeninin ve bir IDTSInput100 parametre olarak aşağı akım bileşenidir. Varsayılan olarak, bileşen çağrısı ProvideComponentProperties() yöntem, girişleri olan bileşenler için tek bir giriş ve çıkışlarını olan bileşenler için tek bir çıktı oluşturur. Aşağıdaki örnekte, bu varsayılan çıktı, kaynak ve hedef giriş kullanır.

Sonraki adım

Iki bileşeni arasında bir yol kurduktan sonra sonraki konuda tartışılan aşağı akım bileşenindeki giriş sütunları eşleştirmek için sonraki adım olacaktır Giriş sütunlar programsal olarak seçme.

Örnek

Aşağıdaki kod örneği, iki bileşeni arasında bir yol oluşturmak üzere gösterilmiştir.

using System;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Microsoft.SqlServer.Dts.Samples
{
  class Program
  {
    static void Main(string[] args)
    {
      Package package = new Package();
      Executable e = package.Executables.Add("STOCK:PipelineTask");
      TaskHost thMainPipe = e as TaskHost;
      MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;

      // Create the source component.  
      IDTSComponentMetaData100 source =
        dataFlowTask.ComponentMetaDataCollection.New();
      source.ComponentClassID = "DTSAdapter.OleDbSource";
      CManagedComponentWrapper srcDesignTime = source.Instantiate();
      srcDesignTime.ProvideComponentProperties();

      // Create the destination component.
      IDTSComponentMetaData100 destination =
        dataFlowTask.ComponentMetaDataCollection.New();
      destination.ComponentClassID = "DTSAdapter.OleDbDestination";
      CManagedComponentWrapper destDesignTime = destination.Instantiate();
      destDesignTime.ProvideComponentProperties();

      // Create the path.
      IDTSPath100 path = dataFlowTask.PathCollection.New();
      path.AttachPathAndPropagateNotifications(source.OutputCollection[0],
        destination.InputCollection[0]);
    }
  }

}

Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Module Module1

  Sub Main()

    Dim package As Microsoft.SqlServer.Dts.Runtime.Package = _
      New Microsoft.SqlServer.Dts.Runtime.Package()
    Dim e As Executable = package.Executables.Add("STOCK:PipelineTask")
    Dim thMainPipe As Microsoft.SqlServer.Dts.Runtime.TaskHost = _
      CType(e, Microsoft.SqlServer.Dts.Runtime.TaskHost)
    Dim dataFlowTask As MainPipe = CType(thMainPipe.InnerObject, MainPipe)

    ' Create the source component.  
    Dim source As IDTSComponentMetaData100 = _
      dataFlowTask.ComponentMetaDataCollection.New()
    source.ComponentClassID = "DTSAdapter.OleDbSource"
    Dim srcDesignTime As CManagedComponentWrapper = source.Instantiate()
    srcDesignTime.ProvideComponentProperties()

    ' Create the destination component.
    Dim destination As IDTSComponentMetaData100 = _
      dataFlowTask.ComponentMetaDataCollection.New()
    destination.ComponentClassID = "DTSAdapter.OleDbDestination"
    Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate()
    destDesignTime.ProvideComponentProperties()


    ' Create the path.
    Dim path As IDTSPath100 = dataFlowTask.PathCollection.New()
    path.AttachPathAndPropagateNotifications(source.OutputCollection(0), _
      destination.InputCollection(0))

  End Sub

End Module
Integration Services icon (small) Tümleştirme Hizmetleri ile güncel kalın

Karşıdan yüklemeler, makaleleri, örnekler ve en son Microsoft video yanı sıra, seçili topluluğun çözümleri için ziyaret Integration Services sayfa MSDN veya TechNet:

Bu güncelleştirmelerin otomatik bildirim için kullanılabilir RSS akışlarına abone olmak sayfa.