Home SSIS Script Task Error: exception has been thrown by the target of an invocation
Reply: 0

SSIS Script Task Error: exception has been thrown by the target of an invocation

Momin Goni
1#
Momin Goni Published in 2017-11-14 14:10:44Z

I am trying to pass user variables into an SSIS script task to use them in the similarly structured following if clause:-

VariableY= Directory.GetFiles(Dts.Variables("User::VarX").Value.ToString, 
"*.*", SearchOption.TopDirectoryOnly)

For Each VarZ In VariableY
If VarZ.ToString.Contains(Dts.Variables("User::Var1").Value.ToString) Then
localVar = 1
End If

However upon executing it throws and error of the a vague nature with the statement 'exception has been thrown by the target of an invocation'. Previously in the if clause, the values were being hard-coded in the contains() function, which executes smoothly. Any suggestions to solve this?

Edit:- [Error Message]

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
atMicrosoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31148 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO