0

I declared a variable as below in script task

dynamic sqldata = Dts.Variables["User::sqldata"].Value;

When I try to click OK for script task component, error coming as below

enter image description here

But when I replace dynamic keyword with object or var, which works fine.

So why dynamic datatype not working in script task?

6
  • Which error do you get inside your script task? You most have some kinda error message. Commented Jul 23, 2018 at 10:56
  • no compilation errors inside script task project, all green and no reds Commented Jul 23, 2018 at 11:11
  • If i try to make my variable into a dynamic variable i dont get any errors Commented Jul 23, 2018 at 11:13
  • Have you tried to set your variable into ReadOnlyVariables? Cant see if you have it in ReadWriteVariables? Commented Jul 23, 2018 at 11:14
  • What version of ssis? Commented Jul 23, 2018 at 13:41

2 Answers 2

3

stumbled across query when I had this same error myself so I thought I'd share my findings. My solution was to add Microsoft.CSharp as a reference when editing the script.

  1. Edit the script component in the dataflow
  2. Edit the script
  3. Right click on References in the Solution Explorer
  4. Add the reference "Microsoft.CSharp"
  5. Use it in your class - Using Microsoft.CSharp;

Hope that helps!

Sign up to request clarification or add additional context in comments.

Comments

0

Cannot find data type dbo.type in ssis

Change it into:

case "Double": return "[nvarchar](250)";

3 Comments

Is that a quote of an error message you get and want help with? Is this an attempt to answer according to How to Answer? In that case please edit and make that more obious. Currently this post does not give an impression of being an attempt to answer the question at the top of this page, but it should.
The edit by @Dominique seems quite plausible (thanks), but if you are fine with it, this post now now turned into a code only answer, for which the following hint is applicable.
Welcome to Stack Overflow! While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.