0

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()

Mazhar
  • 3,797
  • 1
  • 12
  • 29
Momin Goni
  • 19
  • 4

0 Answers0