Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The name 'Dts' does not exist in its current context

I’m trying to run a send email Script task in SSIS because I need it in the Data flow task.

I’m getting

The name ‘Dts’ does not exist in its current context

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

error

Is there a missing namespace?

screenshot of error

namespaces

>Solution :

There are two Script named things in SSIS.

A Script Task is a top level activity that occurs in the Control Flow section of an SSIS package. This is the "do anything in .NET that we didn’t build into SSIS" swiss army knife.

A Script Component is a Data Flow specific activity that occurs within the context of a Data Flow Task. These can operate on a per-row basis, be the source, sink or just a modifier of data rows.

As Yitzhak observes, it appears you are using the wrong one.

To access variables in a Script Task, assuming you’ve checked the box to add them into the Script, you would access them as you have shown. i.e. string htmlMessageFrom = Dts.Variables["EmailFrom"].Value.ToString();

To access variables in a Script Component, that’s a different route. You’d still need to indicate which variables are available to the component but there is no need to cast the data to the appropriate type as it will be strongly typed as you access it. e.g. string htmlMessageFrom = this.Variables.EmailFrom;

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading