Question using SSIS 2008 Script Task

  • Receiving the following error message

    Microsoft.SqlServer.Dts.Pipeline.Cannot Create User ComponentException: Cannot create user component class. Trying to create a simple script task using Variables and input columns.

    Need assistance please.

    Script code follows

    ' Microsoft SQL Server Integration Services Script Component

    ' Write scripts using Microsoft Visual Basic 2008.

    ' ScriptMain is the entry point class of the script.

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _

    <CLSCompliant(False)> _

    Public Class ScriptMain

    Inherits UserComponent

    Public Overrides Sub PreExecute()

    MyBase.PreExecute()

    Dim sPaymentMethod As String

    '

    ' Add your code here for preprocessing or remove if not needed

    ''

    End Sub

    Public Overrides Sub PostExecute()

    MyBase.PostExecute()

    Dts.Variables("User::PaymentMethod").Value = sPaymentMethod

    End Sub

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    If Dts.Variables("User::TestProduct").Value = "C800806" Then

    Then sPaymentMethod = "C"

    Else : sPaymentMethod = "A"

    End If

    End Sub

    End Class

  • Now trying :

    ' Microsoft SQL Server Integration Services Script Component

    ' Write scripts using Microsoft Visual Basic 2008.

    ' ScriptMain is the entry point class of the script.

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _

    <CLSCompliant(False)> _

    Public Class ScriptMain

    Inherits UserComponent

    Public Sub Main()

    Dim sPaymentMethod As String

    Dim strProduct As String

    strProduct = (Dts.Variables("TestProduct").Value.ToString)

    If strProduct = "C800806" Then

    Then sPaymentMethod = "C" Else sPaymentMethod = "A"

    End If

    Dts.Variables("PaymentMethod").Value = sPaymentMethod

    End Sub

    End Class

    Getting error message does not like Dts.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply