dovk179
dovk179

Reputation: 13

In SSIS package passing parameter value to variable gives runtime error

I am trying to build a package with a Script Task and load parameter values to local variables.

I created Project and package Parameters. enter image description here

and called them into the script task editor In the script Editor I entered the following script enter image description here Build show success! Executing the package I get a RunTime error

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) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

And That unfortunately I don't understand the Message. Need help!

Thanks Dov

Upvotes: 0

Views: 1539

Answers (1)

kzhen
kzhen

Reputation: 3128

I was able to reproduce the error you posted above, it appears that the problem is with the casing of the variables in your script.

First of all you will need to make sure you have set the variables as either Readonly or ReadWrite, you can do this on the properties of the script task

enter image description here

Then you will need to update your variables:

It should be:

$Project::ServerName instead of $project::ServerName

Notice the difference in case of Project and project - this is what's causing your problem.

enter image description here

Upvotes: 0

Related Questions