none
vb script explanation in scrpt compoenet

    Question

  • Imports System.Data.SqlClient
    ...
    Public Class ScriptMain
        Inherits UserComponent
    
        Dim connMgr As IDTSConnectionManager100
        Dim sqlConn As SqlConnection
        Dim sqlReader As SqlDataReader
    
        Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
    
            connMgr = Me.Connections.MyADONETConnection
            sqlConn = CType(connMgr.AcquireConnection(Nothing), SqlConnection)
    
        End Sub
    
        Public Overrides Sub PreExecute()
    
            Dim cmd As New SqlCommand("SELECT AddressID, City, StateProvinceID FROM Person.Address", sqlConn)
            sqlReader = cmd.ExecuteReader
    
        End Sub
    
        Public Overrides Sub CreateNewOutputRows()
    
            Do While sqlReader.Read
                With MyAddressOutputBuffer
                    .AddRow()
                    .AddressID = sqlReader.GetInt32(0)
                    .City = sqlReader.GetString(1)
                End With
            Loop
    
        End Sub
    
        Public Overrides Sub PostExecute()
    
            sqlReader.Close()
    
        End Sub
    
        Public Overrides Sub ReleaseConnections()
    
            connMgr.ReleaseConnection(sqlConn)
    
        End Sub
    
    End Class

    The above is a sample for script component in msdn I am confused of were to put it in the scriptmain as attached to this post .Please direction.

    Thanks

    Friday, August 01, 2014 9:24 PM

Answers