tags:

views:

166

answers:

1

Code

Class ApplicationTests
        Shared  Sub Main(ByVal args() As String)
            ' The variable pkg points to the location of the
            ' ExecuteProcess package sample installed with
            ' the SSIS samples.
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 

            Dim app As Application =  New Application() 
            Dim p As Package =  app.LoadPackage(pkg,Nothing) 
           ' Now that the package is loaded, we can query on
           ' its properties.
            Dim n As Integer =  p.Configurations.Count 
            Dim p2 As DtsProperty =  p.Properties("VersionGUID") 
            Dim pl As DTSProtectionLevel =  p.ProtectionLevel 

            Console.WriteLine("Number of configurations = " + n)
            Console.WriteLine("VersionGUID = " + p2)
            Console.WriteLine("ProtectionLevel = " + pl)
        End Sub
End Class

IS it possible to use DTS packages(.dts) instead of ssis(.dtsx) in LoadPackage() in the above code ???? or give me a solution to load a DTS package..

+1  A: 

Since you're using 2005+, I believe it only works with DTSX. But, there's a fix! SSIS allows you to execute a DTS package task. Build a DTSX package with that as its only task, and you'll essentially run the DTS package.

That, or attach to a 2000 machine.

Eric
Eric Thanks for ur reply...Actually i dont need to execute the dts package.i hav to copy all the properties ,queries in datapumping etc in to a varriable.In the above code LoadPackage method using for .dtsx package. But when we r using .dts package in these Loadpackage an error is coming.so is der any replacement for the LoadPackage() in .dts???