Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1268
  • Last Modified:

SSIS 2012 dts.variable not declared

Hi All,
I am migrating an existing package, working packages, from SQL2005 to SQL2012.
I have variables that are passed/used in a Script Task.  My problem is the Dts.Variables statement does not recognize the "dts.".
Says it's not declared.  I don't understand why it works find on my production server (SQL2005) and not here.
I also tried finding the assemblies needed and one article mentioned Microsoft.SqlServer.ScriptTask; but I can't find this.

Below is the my first problem string....
Dim File_Name$ = DTS.Variables("User::DB_File_Name").Value.ToString

Any help would be greatly appreciated it.
  • 3
1 Solution
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Make sure User::DB_File_Name is listed in either ReadOnlyVariables or ReadWriteVariables, then..

Dim File_Name as String
SET File_name = DTS.Variables("DB_File_Name").Value.ToString
Thunder724Author Commented:
yup, they are.  Exact same project that is working on the other box.
Thunder724Author Commented:
Think I got it.
I needed to add the following to the class of the file......

'ScriptMain is the entry point class of the script.  Do not change the name, attributes,
    'or parent of this class.
    <Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()> _
    <System.CLSCompliantAttribute(False)> _
    Partial Public Class ScriptMain
        Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Thunder724Author Commented:
I figured the problem out.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now