2
votes

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.

1
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?Brad
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.Ahpitre
Ok, just confirming its not object (those need to be handled differently) and if string is super large can cause issues as well.Brad
Can you provide your code in the c# task pleaseBrad
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.Ahpitre

1 Answers

2
votes

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.