Export (0) Print
Expand All

ScriptComponent.PostExecute Method

Executes custom code that must run after the Script component has processed its inputs and outputs.

Namespace:  Microsoft.SqlServer.Dts.Pipeline
Assembly:  Microsoft.SqlServer.TxScript (in Microsoft.SqlServer.TxScript.dll)

public virtual void PostExecute()

The Script component developer does not use the ScriptComponent class directly, but indirectly, by coding the methods and properties of the ScriptMain class, which inherits from ScriptComponent through the UserComponent class.

The developer can override the PostExecute method to perform cleanup or any one-time tasks necessary after processing the rows of data.

The following code sample demonstrates how the Script component developer might use the PreExecute and PostExecute methods to open and close a text file connection before and after processing. For more information on this sample, see Creating a Destination with the Script Component.

Imports System.IO
Public Class ScriptMain
    Inherits UserComponent

    Dim copiedAddressFile As String
    Private textWriter As StreamWriter
    Private columnDelimiter As String = ","

    Public Overrides Sub AcquireConnections(ByVal Transaction As Object)

        Dim connMgr As IDTSConnectionManager100 = _
        copiedAddressFile = CType(connMgr.AcquireConnection(Nothing), String)

    End Sub

    Public Overrides Sub PreExecute()

        textWriter = New StreamWriter(copiedAddressFile, False)

    End Sub

    Public Overrides Sub MyAddressInput_ProcessInputRow(ByVal Row As MyAddressInputBuffer)

        With textWriter
            If Not Row.AddressID_IsNull Then
            End If
            If Not Row.City_IsNull Then
            End If
        End With

    End Sub

    Public Overrides Sub PostExecute()


    End Sub

End Class

Community Additions

© 2014 Microsoft