简体   繁体   中英

SSIS C# Script Task not reading variable or parameter

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM