Exporting DTS Package to VB

  • I'm in the process of moving code from a DTS Package to a VB Application and running into a problem with part of the code..  can anyone tell me why I'm getting User-Defined type not defined when this executes:

    '------------- define Task_Sub2 for task DTSTask_DTSDynamicPropertiesTask_1 (Dynamic Properties Task: Set Values)

    Public Sub Task_Sub2(ByVal goPackage As Object)

    Dim oTask As DTS.Task

    Dim oLookup As DTS.Lookup

    Dim oCustomTask2 As DTSCustTasks.DynamicPropertiesTask  ' This line fails

    Set oTask = goPackage.Tasks.New("DTSDynamicPropertiesTask")

    Set oCustomTask2 = oTask.CustomTask

        oCustomTask2.Name = "DTSTask_DTSDynamicPropertiesTask_1"

        oCustomTask2.Description = "Dynamic Properties Task: Set Values"

       

        Dim oAssignment As DTSCustTasks.DynamicPropertiesTaskAssignment

        '------- An Assignment is defined here

        Set oAssignment = oCustomTask2.Assignments.New

            oAssignment.SourceType = 2

            oAssignment.SourceQueryConnectionID = -1

            oAssignment.SourceGlobalVariable = "TextPAPFileName"

            oAssignment.DestinationPropertyID = "'Connections';'Text File (Source)';'OLEDBProperties';'Data Source';'Properties';'Value'"

           

        oCustomTask2.Assignments.Add oAssignment

        Set oAssignment = Nothing

        '------- An Assignment is defined here

        Set oAssignment = oCustomTask2.Assignments.New

            oAssignment.SourceType = 2

            oAssignment.SourceQueryConnectionID = -1

            oAssignment.SourceGlobalVariable = "TextReplFileName"

            oAssignment.DestinationPropertyID = "'Connections';'Text File (Source) 2';'OLEDBProperties';'Data Source';'Properties';'Value'"

           

        oCustomTask2.Assignments.Add oAssignment

        Set oAssignment = Nothing

        '------- An Assignment is defined here

        Set oAssignment = oCustomTask2.Assignments.New

            oAssignment.SourceType = 2

            oAssignment.SourceQueryConnectionID = -1

            oAssignment.SourceGlobalVariable = "TextProcritExcelFileName"

            oAssignment.DestinationPropertyID = "'Connections';'Microsoft Excel 97-2000';'OLEDBProperties';'Data Source';'Properties';'Value'"

           

        oCustomTask2.Assignments.Add oAssignment

        Set oAssignment = Nothing

        '------- An Assignment is defined here

        Set oAssignment = oCustomTask2.Assignments.New

            oAssignment.SourceType = 2

            oAssignment.SourceQueryConnectionID = -1

            oAssignment.SourceGlobalVariable = "TextProcritExcelFileName"

            oAssignment.DestinationPropertyID = "'Tasks';'DTSTask_DTSSendMailTask_1';'Properties';'FileAttachments'"

           

        oCustomTask2.Assignments.Add oAssignment

        Set oAssignment = Nothing

    goPackage.Tasks.Add oTask

    Set oCustomTask2 = Nothing

    Set oTask = Nothing

    End Sub

  • Could it be you haven't registered the DTSCustTasks COM library as project reference?

    Trey Johnson | Chief Business Intelligence Architect | Cizer Software (www.cizer.com)

    Who? - Cizer - http://www.cizer.com/about.htm - Blog - http://www.sqlserverbi.com/
    What? - Products enhancing Microsoft Business Intelligence - http://www.cizer.com/products.htm
    Wow! - Empower your Developers.... NEW Drop In Reporting - http://www.cizer.com/cnr-drop-in-reporting.htm
    How? - BI Training - http://www.cizer.com/training.htm - Cizer Solutions - http://www.cizer.com/solutions.htm

  • Aslo, if you do any data pumping (importing from an outside data source) You'll also need to add a reference to the data pump component. Each of them can befound (when sorted alphebitaclly) under SQL DTS XXXXXXXX. Depending on what your package is trying to accomplish, you'll need several of them.

    TG

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply