Getting info fromthe DTS object model

  • I'm trying to get some information about my DTS package via an activex script.  I'm querying the DTS object model and have run into an issue.

    Here is the script:

    Dim oPackage       'Define a variable to hold this packages details

    Set oPackage=DTSGlobalVariables.Parent   'Place the active package into the variable oPackage

    Dim oTask       'Define a variable to hold a Task that belongs to the package

    Set oTask=oPackage.Tasks("DTSTask_DataPumpTask1")  'Place the task into the variable o.Task

    msgbox oTask.description    'Display the description of the task in the variable

     

    I receive the error: task DTSTask_DataPumpTask1 name was not found.  If I look under package variables under package name-->Tasks..the task does exist.  Any ideas?

     

  • Is it as simply as a typo -- try..."DTSTask_DataPumpTask_1" with the underscore before the task number.

  • Changed the code and received the same error.  However if  I do the following it works:

    Dim oPackage      

    Set oPackage=DTSGlobalVariables.Parent  

    Dim oTask

    Set oTask=oPackage.("DTSStep_DTSDataPumpTask_1")

    -->I removed ".Tasks"

    That doesn't seem right.  Eventually I want to access some of the properties for the task.

  • This is what I use when I change the SQL of a datapump...

     ' Get reference to the DataPump Task

     Set objPkg = DTSGlobalVariables.Parent

     Set objDataPump = objPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask

     ' Assign SQL Statement to Source of DataPump

     objDataPump.SourceSQLStatement = mySQL

    You might want to try using the "CustomTask" as part of your code.

  • Your information was great.  Thanks very much for your help.

Viewing 5 posts - 1 through 4 (of 4 total)

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