Export (0) Print
Expand All

PackageInfos.Item Property

Retrieves the PackageInfo object from the collection.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public PackageInfo this[
	Object index
] { get; }

Parameters

index
Type: Object
The index of the object in the collection to return.

Property Value

Type: Microsoft.SqlServer.Dts.Runtime.PackageInfo
Returns the PackageInfo object from the collection that matches the index description provided in the index parameter.

The following code example returns the name of the package found at item location 0 using the syntax, PackageInfos[index].

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace PackageInfoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string pkg = @"C:\Program Files\ Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
            string pkg2 = @"C:\Program Files\ Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";

            Application app = new Application();
            Package p1 = app.LoadPackage(pkg, null);
            Package p2 = app.LoadPackage(pkg2, null);
            p1.Description = "UsingExecuteProcess package";
            p2.Description = "CalculatedColumns package";

            app.SaveToDtsServer(p1, null, @"File System\myp1Package", "YOURSERVER");
            app.SaveToDtsServer(p2, null, @"File System\myp2Package", "YOURSERVER");

            PackageInfos pInfos = app.GetDtsServerPackageInfos(@"File System", "YOURSERVER");
            Console.WriteLine("Number of Packages {0}", pInfos.Count.ToString());

            String pInfoName = pInfos[0].Name;
            Console.WriteLine("PackageInfo item 0 is named {0} ", pInfoName);
         }
    }
}

Sample Output:

Number of Packages 2

PackageInfo item 0 is named myp1Package

Community Additions

ADD
Show:
© 2014 Microsoft