2

I have a C# Script Task in an SSIS 2016 project, using Visual Studio 2017 SSDT version.

The Script task builds the body message of an email, Send Email Task later sends the email. Script task is able to read package variables with data from a query, everything works great, but, there is one variable that it doesn't read the actual value, rather, replaces the value with "Microsoft.SqlServer.Dts.Runtime.Variable".

I have tried with project parameters, package variables, etc., but nothing works. In the past, in other SSIS projects I was able to do this. Script Task is not generating any errors, runs fine, it just doesn't read the actual value of the variable or parameter. Weird.

6
  • What is the datatype of the variable you are having issues reading? Is it an Object? Or would it be a string with more than 8000 characters (this can cause issues)? How is it being populated? Commented Mar 15, 2019 at 14:59
  • In SSIS it is a Project param of String data type. Contents is just text, currently 119 characters. In the past I have done this with larger strings w/o any issues. Commented Mar 15, 2019 at 15:05
  • Ok, just confirming its not object (those need to be handled differently) and if string is super large can cause issues as well. Commented Mar 15, 2019 at 15:22
  • Can you provide your code in the c# task please Commented Mar 15, 2019 at 15:22
  • Found the issue, one line of code was using variablename.ToString(). Changed it to variablename.Value. This would also work (although really not needed) : variablename.Value.ToString() Works now. Commented Mar 15, 2019 at 15:45

1 Answer 1

2

Found the issue, one line of code was using variablename.ToString(). Changed it to variablename.Value.

This would also work (although really not needed) : variablename.Value.ToString()

Works now.

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

1 Comment

even if this is your own answer you have to mark it accepted. click on the mark on the left side of the answer.

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.