共用方式為


PipelineBuffer.DirectRow Method

Sends a row from a PipelineBuffer to the specified IDTSOutput90.

命名空間: Microsoft.SqlServer.Dts.Pipeline
組件: Microsoft.SqlServer.PipelineHost (in microsoft.sqlserver.pipelinehost.dll)

語法

'宣告
Public Sub DirectRow ( _
    outputID As Integer _
)
public void DirectRow (
    int outputID
)
public:
void DirectRow (
    int outputID
)
public void DirectRow (
    int outputID
)
public function DirectRow (
    outputID : int
)

參數

備註

更新的範例程式碼:2005 年 12 月 5 日

The DirectRow method is called by components that contain multiple outputs in the same ExclusionGroup. It is used to direct a PipelineBuffer row to the specified output—a specific output in the component. This method can be used for error and non-error outputs, however, the DirectErrorRow method should be used to send rows to an error output.

If a component that has two synchronous outputs in the same exclusion group advances a buffer to the next row using the NextRow method without directing the row to a specific output, the row is sent to both outputs.

範例

The following example shows a component that contains two outputs in the same exclusion group. During ProcessInput rows are sent to one or the other of the outputs by using DirectRow method.

public override void ProvideComponentProperties()
{
    IDTSInput90 input = ComponentMetaData.InputCollection.New();
    Input.Name = "DTSSampleInput";

    IDTSOutput output = ComponentMetaData.OutputCollection.New();
    output.ExclusionGroup = 1;
    output.Name = "Output1";
    output.SynchronousInputID = input.ID;

    IDTSOutput output = ComponentMetaData.OutputCollection.New();
    output.ExclusionGroup = 1;
    output.Name = "Output2";
    output.SynchronousInputID = input.ID;
}
public override void ProcessInput(int inputID, PipelineBuffer buffer)
{
    IDTSInput90 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);

    IDTSOutput90 output1 = ComponentMetaData.OutputCollection[0];
    IDTSOutput90 output2 = ComponentMetaData.OutputCollection[1];

    if(! buffer.EndOfRowset)
    {
        while( buffer.NextRow())
        {
            // TODO: Insert if/then block here.
            // If criteria is met, direct the buffer row to output1.
            buffer.DirectRow(output1.ID);
            // Otherwise, direct the row to output2.
            buffer.DirectRow(output2.ID);
        }
    }
}
Public Overrides Sub ProvideComponentProperties() 
 Dim input As IDTSInput90 = ComponentMetaData.InputCollection.New 
 Input.Name = "DTSSampleInput" 
 Dim output As IDTSOutput = ComponentMetaData.OutputCollection.New 
 output.ExclusionGroup = 1 
 output.Name = "Output1" 
 output.SynchronousInputID = input.ID 
 Dim output As IDTSOutput = ComponentMetaData.OutputCollection.New 
 output.ExclusionGroup = 1 
 output.Name = "Output2" 
 output.SynchronousInputID = input.ID 
End Sub 

Public  Overrides Sub ProcessInput(ByVal inputID As Integer, ByVal buffer As PipelineBuffer) 
 Dim input As IDTSInput90 = ComponentMetaData.InputCollection.GetObjectByID(inputID) 
 Dim output1 As IDTSOutput90 = ComponentMetaData.OutputCollection(0) 
 Dim output2 As IDTSOutput90 = ComponentMetaData.OutputCollection(1) 
 If Not buffer.EndOfRowset Then 
   While buffer.NextRow 
    ' TODO: Insert if/then block here.
    ' If criteria is met, direct the buffer row to output1.
     buffer.DirectRow(output1.ID) 
    ' Otherwise, direct the row to output2.
     buffer.DirectRow(output2.ID) 
   End While 
 End If 
End Sub

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

PipelineBuffer Class
PipelineBuffer Members
Microsoft.SqlServer.Dts.Pipeline Namespace