x
login about faq Site discussion (meta-askssc)

SSIS - Referencing This Package in Script

I have an SSIS Package. I need to write a VB.NET (or C#) script task inside the pkg that looks at a specific Sequence Container in the same SSIS Package, cycles through all the executables and stores the names of those executables into an ADO recordset for later use.

I'm stuck on the first step: How do I reference the SSIs pkg from inside?

Dim pkg as Package
pkg = ?
more ▼

asked Sep 14 '12 at 04:54 PM in Default

Mongr1l gravatar image

Mongr1l
0 1

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

1 answer: sort voted first

hi ,

you need to read the package from where it is saved.

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime;

using Microsoft.SqlServer.Dts.Tasks;

namespace PROFILE

{

class Program

{

static void Main(string[] args)

{

  Application app = new Application();

  string a;

  Package p;

  TaskHost t;

  p = new Package();

  p = app.LoadPackage("C:\\Visual Studio 2005\\PROFILE.dtsx", null);

  for (int i = 0; i < p.Executables.Count; i++)

  {
    Console.WriteLine("Component : " + p.Executables[i].ToString() );

    //Console.WriteLine(i);

    a = p.Executables[i].GetType().ToString();

    Console.WriteLine(p.Executables[i].GetType());

  }

  Console.ReadKey();    
}
}

}

reference link below Reference

more ▼

answered Sep 25 '12 at 06:25 AM

aRookieBIdev gravatar image

aRookieBIdev
2k 24 40 46

(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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x750

asked: Sep 14 '12 at 04:54 PM

Seen: 247 times

Last Updated: Sep 25 '12 at 06:30 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.