Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

SSIS SSDT 2012 Script Task Exception Error

$
0
0

SSIS SSDT 2012 Script Task

3 Read Only Variables defined Package variables

USer::RunDay, User::RunMonth, User::RunYear

1 ReadWrite variable defined package variable

User::RunMonthMinus2

The Script

Public Sub Main()
        Dim lYear As Integer
        Dim lMonth As Integer
        Dim sYear As String
        Dim sMonth As String
        Dim sMonthMinus2 As String
        lYear = Dts.Variables("user::RunYear").Value
        lMonth = Dts.Variables("user::RunMonth").Value
        If lMonth <= 2 Then
            lYear = lYear - 1
            If lMonth = 1 Then
                lMonth = 11
            Else
                If lMonth = 2 Then
                    lMonth = 12
                End If
            End If
        Else
            lMonth = lMonth - 2
        End If
        sMonth = lMonth
        sYear = lYear
        sMonthMinus2 = sYear + "-" + sMonth + "-16"
        Dts.Variables("user::RunMonthMinus2").Value = sMonthMinus2
        Dts.TaskResult = ScriptResults.Success
    End Sub

When I execute it in the debugger I get a pop up error:

DTD Script Task: Runtime Error

DTS Script task has encountered an exception in user code:

Exception has been thrown by target of an invocation.

In the box is a long list of objects, methods, and arguments.

at System.RuntimeMethodHandle.InvokeMethod(arguments)

at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(arguments)

at System.Reflection.RuntimeMethodInfo.Invoke(arguments)

at System.RUntimeType.InvokeMembat System.Runtimee(arguments)

at Microsoft.SQLServer.DTS.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

I have SQL Server 2012, VIsual Studio 2012 with SSDT 2012 installed.

Can anyone decipher what the problem is?




Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>