PipelineBuffer.DirectErrorRow Metodo

Definizione

Invia una riga PipelineBuffer a un oggetto IDTSOutput100 la cui proprietà IsErrorOut è true.

Overload

DirectErrorRow(Int32, Int32, Int32)

Invia una PipelineBuffer riga a un IDTSOutput100 oggetto la cui IsErrorOut proprietà è true.

DirectErrorRow(Int32, Int32, Int32, Int32)

Invia una PipelineBuffer riga a un IDTSOutput100 oggetto la cui IsErrorOut proprietà è true.

DirectErrorRow(Int32, Int32, Int32)

Invia una PipelineBuffer riga a un IDTSOutput100 oggetto la cui IsErrorOut proprietà è true.

public:
 void DirectErrorRow(int outputID, int errorCode, int errorColumn);
public void DirectErrorRow (int outputID, int errorCode, int errorColumn);
member this.DirectErrorRow : int * int * int -> unit
Public Sub DirectErrorRow (outputID As Integer, errorCode As Integer, errorColumn As Integer)

Parametri

outputID
Int32

ID dell'errore IDTSOutput100 per inviare la riga PipelineBuffer.

errorCode
Int32

Numero dell'errore che si è verificato durante l'elaborazione della riga.

errorColumn
Int32

ID della colonna PipelineBuffer che ha causato l'errore.

Esempio

Nell'esempio di codice seguente viene illustrato come indirizzare una riga in un buffer a un output di errore sincrono usando il DirectErrorRow metodo .

public override void ProcessInput(int inputID, PipelineBuffer buffer)  
{  
        IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);  

        /// This code sample assumes the component has 2 outputs, one the default,  
        /// the other the error output. If the errorOutputIndex returned from GetErrorOutputInfo  
        /// is 0, then the default output is the second output in the collection.  
        int defaultOutputID = -1;  
        int errorOutputID = -1;  
        int errorOutputIndex = -1;  

        GetErrorOutputInfo(ref errorOutputID,ref errorOutputIndex);  

        if (errorOutputIndex == 0)  
            defaultOutputID = ComponentMetaData.OutputCollection[1].ID;  
        else  
            defaultOutputID = ComponentMetaData.OutputCollection[0].ID;  

        while (buffer.NextRow())  
        {  
            try  
            {  
                /// TODO: Implement code to process the columns in the buffer row.  

                /// Ideally, your code should detect potential exceptions prior to them occurring, rather  
                /// than having a generic try/catch block such as this.   
                /// However, since the error or truncation implementation is specific to each component  
                /// this sample focuses on actually directing the row, and not a single error or truncation.  

                /// Unless an exception occurs, direct the row to the default   
                buffer.DirectRow(defaultOutputID);  
            }  
            catch  
            {  
                /// Yes. Has the user specified to redirect the row?  
                if (input.ErrorRowDisposition == DTSRowDisposition.RD_RedirectRow)  
                {  
                    /// Yes, direct the row to the error output.  
                    /// TODO: Add code to include the errorColumnID  
                    buffer.DirectErrorRow(errorOutputID, 0, errorColumnID);  
                }  
                else if (input.ErrorRowDisposition == DTSRowDisposition.RD_FailComponent || input.ErrorRowDisposition == DTSRowDisposition.RD_NotUsed)  
                {  
                    /// No, the user specified to fail the component, or the error row disposition was not set.  
                    throw new Exception("An error occurred, and the DTSRowDisposition is either not set, or is set to fail component.");  
                }  
                else  
                {  
                    /// No, the user specified to ignore the failure so   
                    /// direct the row to the default output.  
                    buffer.DirectRow(defaultOutputID);  
                }  

            }  
        }  
}  
Public  Overrides Sub ProcessInput(ByVal inputID As Integer, ByVal buffer As PipelineBuffer)   
   Dim input As IDTSInput100 = ComponentMetaData.InputCollection.GetObjectByID(inputID)   
   Dim defaultOutputID As Integer = -1   
   Dim errorOutputID As Integer = -1   
   Dim errorOutputIndex As Integer = -1   
   GetErrorOutputInfo(errorOutputID, errorOutputIndex)   
   If errorOutputIndex = 0 Then   
     defaultOutputID = ComponentMetaData.OutputCollection(1).ID   
   Else   
     defaultOutputID = ComponentMetaData.OutputCollection(0).ID   
   End If   
   While buffer.NextRow   
     Try   
       buffer.DirectRow(defaultOutputID)   
     Catch   
       If input.ErrorRowDisposition = DTSRowDisposition.RD_RedirectRow Then   
         buffer.DirectErrorRow(errorOutputID, 0, errorColumnID)   
       Else   
         If input.ErrorRowDisposition = DTSRowDisposition.RD_FailComponent OrElse input.ErrorRowDisposition = DTSRowDisposition.RD_NotUsed Then   
           Throw New Exception("An error occurred, and the DTSRowDisposition is either not set, or is set to fail component.")   
         Else   
           buffer.DirectRow(defaultOutputID)   
         End If   
       End If   
     End Try   
   End While   
End Sub  

Commenti

Questo metodo viene usato dai componenti del flusso di dati che dispongono IDTSOutput100 di oggetti con la IsErrorOut proprietà impostata su true. Viene chiamato dal componente quando rileva un errore durante l'elaborazione di una riga del buffer e quando RD_RedirectRow viene specificato nell'input, nell'output o nella colonna.

Si applica a

DirectErrorRow(Int32, Int32, Int32, Int32)

Invia una PipelineBuffer riga a un IDTSOutput100 oggetto la cui IsErrorOut proprietà è true.

public:
 void DirectErrorRow(int row, int outputID, int errorCode, int errorColumn);
public void DirectErrorRow (int row, int outputID, int errorCode, int errorColumn);
member this.DirectErrorRow : int * int * int * int -> unit
Public Sub DirectErrorRow (row As Integer, outputID As Integer, errorCode As Integer, errorColumn As Integer)

Parametri

row
Int32

Indice della riga da indirizzare all'output degli errori.

outputID
Int32

ID dell'errore IDTSOutput100 per inviare la riga PipelineBuffer.

errorCode
Int32

Numero dell'errore che si è verificato durante l'elaborazione della riga.

errorColumn
Int32

ID della colonna PipelineBuffer che ha causato l'errore.

Commenti

Un componente flusso di dati chiama questo metodo se il componente flusso di dati ha IDTSOutput100 oggetti le cui rispettive IsErrorOut proprietà sono impostate su true. Il componente chiama questo metodo quando il componente rileva un errore durante l'elaborazione di una riga del buffer e quando RD_RedirectRow viene specificato nell'input, nell'output o nella colonna.

Si applica a