다음을 통해 공유


ScriptComponent.PostExecute Method

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

네임스페이스: Microsoft.SqlServer.Dts.Pipeline
어셈블리: Microsoft.SqlServer.TxScript (in microsoft.sqlserver.txscript.dll)

구문

‘선언
Public Overridable Sub PostExecute
public virtual void PostExecute ()
public:
virtual void PostExecute ()
public void PostExecute ()
public function 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.

[Visual Basic]
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 IDTSConnectionManager90 = _
            Me.Connections.MyFlatFileDestConnectionManager
        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
                .Write(Row.AddressID)
            End If
            .Write(columnDelimiter)
            If Not Row.City_IsNull Then
                .Write(Row.City)
            End If
            .WriteLine()
        End With

    End Sub

    Public Overrides Sub PostExecute()

        textWriter.Close()

    End Sub

End Class

스레드 보안

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 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

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