데이터 흐름 태스크에 구성 요소를 추가한 후에는 구성 요소를 연결하여 원본에서 대상으로 변환을 통해 데이터의 흐름을 나타내는 실행 트리를 만듭니다. 개체를 사용하여 IDTSPath100 데이터 흐름의 구성 요소를 연결합니다.
경로 만들기
PathCollection 인터페이스에 있는 MainPipe 속성의 새 메서드를 호출하여 새 경로를 만들고 이 경로를 데이터 흐름 태스크의 경로 컬렉션에 추가할 수 있습니다. 이 메서드는 연결이 끊긴 새 개체를 IDTSPath100 반환한 다음 두 구성 요소를 연결하는 데 사용합니다.
메서드를 AttachPathAndPropagateNotifications 호출하여 경로를 연결하고 경로에 참여하는 구성 요소에 연결되었음을 알립니다. 이 메서드는 IDTSOutput100 업스트림 구성 요소 및 IDTSInput100 다운스트림 구성 요소의 매개 변수를 허용합니다. 기본적으로 구성 요소의 ProvideComponentProperties 메서드를 호출하면 입력이 있는 구성 요소에 대한 단일 입력과 출력이 있는 구성 요소에 대한 단일 출력이 만들어집니다. 다음 예에서는 원본의 이 기본 출력과 대상의 입력을 사용합니다.
이후 수행할 단계
두 구성 요소 간에 경로를 설정한 후 다음 단계는 다음 항목 에서 설명한 다운스트림 구성 요소의 입력 열을 프로그래밍 방식으로 선택하도록 매핑하는 것입니다.
예시
다음 코드 샘플에서는 두 구성 요소 간에 경로를 설정하는 방법을 보여 줍니다.
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를 사용하여 최신 상태 유지
Microsoft의 최신 다운로드, 문서, 샘플 및 비디오와 커뮤니티에서 선택한 솔루션은 MSDN의 Integration Services 페이지를 방문하세요.
MSDN의 Integration Services 페이지 방문
이러한 업데이트에 대한 자동 알림을 보려면 페이지에서 사용할 수 있는 RSS 피드를 구독합니다.