![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I would like to allow the package designer to select a configured connection in my CustomTaskUI property page. However, I have been unable to find a way to get from my CustomTask to its parent package in order to access the Connections collection. I have found some posts about using the DTSGlobalVariables static class from ActiveX script tasks. However, I have not found a way to access this from C#. I am using an RCW around Microsoft.SQLServer.DTSPkg80 now, as it allowed me to properly install my custom task so that it showed up in Enterprise Manager - DTS Designer. I did find a couple articles about loading up the package using LoadFromSQLServer, but I want my task to be decoupled from the package it is used with. If anyone has any advice, I'd appreciate it. Thanks, -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net |
#3
| |||
| |||
|
|
-----Original Message----- I use the CustomTaskUI_Initialize call to grab a refernce to the current task. This can be stored and passed to your form. From the task you can get the parent, the package and then back to the connections collection. The code is VB but the logic is the same- Sample Custom Task Project http://www.sqldts.com/default.aspx?6,107,284,0,0 -- Darren Green http://www.sqldts.com |
#4
| |||
| |||
|
|
Hi Darren, Thanks for the quick response. It gave me a nice kick in the pants! Task.Parent returns a reference to an IDTSStdObject in C#, and when I try to cast this to a Package I get a ClassCastException. I tried printing the GetType.FullName but just got a __ComObject. So I think the Parent is not a Package, but I will need to hack at it to figure out what it is. If you or anyone else has any idea how to get around this roadblock, I'd appreciate it! If I figure it out first, I'll post my solution. |
#5
| |||
| |||
|
|
The parent of a Task is the Tasks collection. The parent of the Tasks collection is the Package, easy when I think about properly. I quick overview of the object model could be represented like this- Package.Tasks.Task.CustomTask Package.Steps.Step.PrecendeceConstraints.Precendec eConstraint Package.Connection.Connection There is a better diagram in Books Online -- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com |
![]() |
| Thread Tools | |
| Display Modes | |
| |