x

SSIS Script Task - The name 'Dts' does not exist in the current context

SSIS Script task C# the following code will not resolve reference to Dts object shows an error "The name 'Dts' does not exist in the current context"

 using System;
 using System.Data;
 using Microsoft.SqlServer.Dts.Runtime;
 using System.IO;
 
 public class ScriptMain
 {
     public void Main() 
  {
      string storpath;
      storpath = 
      
          storpath = (string) **Dts.**Variables["StorPath"].Value;
          string[] files = Directory.GetFiles(storpath);
 foreach (string file in files)
 {
      if (File.Exists(file))
      {
           if (File.GetCreationTime(file) 
               < DateTime.Now.AddDays(-180))
           {
               File.Delete(file);
           }
      }
 }
 }
 }
more ▼

asked Jan 02, 2014 at 05:49 PM in Default

avatar image

GJRyan59
1 2 2 3

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Is it that you have this

 **Dts.**Variables

instead of this

 Dts.Variables

Technet reference

more ▼

answered Jan 04, 2014 at 01:43 AM

avatar image

Mister Magoo
2.1k 2 5 8

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1219
x45

asked: Jan 02, 2014 at 05:49 PM

Seen: 2207 times

Last Updated: Jan 04, 2014 at 01:43 AM

Copyright 2017 Redgate Software. Privacy Policy