dbTalk Databases Forums  

If you have a .NET Custom DTS Task please try this...

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss If you have a .NET Custom DTS Task please try this... in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wm. Scott Miller
 
Posts: n/a

Default If you have a .NET Custom DTS Task please try this... - 10-25-2004 , 03:32 PM






Dear Custom DTS Task Writers:

If you have written a Custom DTS Task in .Net, please attempt to modify your
custom task within an ActiveX script. To do so, add your Custom DTS Task to
a new package, add an ActiveX Script Task, and set its code to similar to
below:

Dim oPackage
Dim oCustomTask

set oPackage = DTSGlobalVariables.Parent
set oCustomTask = oPackage.Tasks("[Get the Tasks name from disconnected
view and paste here]").CustomTask

oCustomTask.[CustomProperty] = "Hello World!" *OR*
oCustomTask.[CustomMethod]

Main = DTSTaskExecResult_Success

The Property or Method must be one you have added other than the ones you
are required to include.......other than Name and Description.

If the script correctly runs, please may I have a copy of your code so I can
figure out what I've done wrong in mine. Mine works for everything, except
for accessing this way.

Scott



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: If you have a .NET Custom DTS Task please try this... - 10-26-2004 , 05:18 AM






Workaround is to use the properties collection, e.g.

oCustomTask.Properties("MyProperty").Value = "Fred"


--
Darren Green
http://www.sqldts.com

"Wm. Scott Miller" <Scott.Miller (AT) spam (DOT) killer.wvinsurance.gov> wrote in
message news:uajBoGtuEHA.1260 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
Dear Custom DTS Task Writers:

If you have written a Custom DTS Task in .Net, please attempt to modify
your
custom task within an ActiveX script. To do so, add your Custom DTS Task
to
a new package, add an ActiveX Script Task, and set its code to similar to
below:

Dim oPackage
Dim oCustomTask

set oPackage = DTSGlobalVariables.Parent
set oCustomTask = oPackage.Tasks("[Get the Tasks name from disconnected
view and paste here]").CustomTask

oCustomTask.[CustomProperty] = "Hello World!" *OR*
oCustomTask.[CustomMethod]

Main = DTSTaskExecResult_Success

The Property or Method must be one you have added other than the ones you
are required to include.......other than Name and Description.

If the script correctly runs, please may I have a copy of your code so I
can
figure out what I've done wrong in mine. Mine works for everything,
except
for accessing this way.

Scott





Reply With Quote
  #3  
Old   
Wm. Scott Miller
 
Posts: n/a

Default Re: If you have a .NET Custom DTS Task please try this... - 10-26-2004 , 08:38 AM



Darren:

Thanks for the reply!

I cut and pasted your code into my routine and all I get is errors.
Specifically, "Wrong number of arguments or invalid property assignment:
'oCustomTask.Properties'" Any ideas?

Scott

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
Workaround is to use the properties collection, e.g.

oCustomTask.Properties("MyProperty").Value = "Fred"


--
Darren Green
http://www.sqldts.com

"Wm. Scott Miller" <Scott.Miller (AT) spam (DOT) killer.wvinsurance.gov> wrote in
message news:uajBoGtuEHA.1260 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Dear Custom DTS Task Writers:

If you have written a Custom DTS Task in .Net, please attempt to modify
your
custom task within an ActiveX script. To do so, add your Custom DTS
Task
to
a new package, add an ActiveX Script Task, and set its code to similar
to
below:

Dim oPackage
Dim oCustomTask

set oPackage = DTSGlobalVariables.Parent
set oCustomTask = oPackage.Tasks("[Get the Tasks name from disconnected
view and paste here]").CustomTask

oCustomTask.[CustomProperty] = "Hello World!" *OR*
oCustomTask.[CustomMethod]

Main = DTSTaskExecResult_Success

The Property or Method must be one you have added other than the ones
you
are required to include.......other than Name and Description.

If the script correctly runs, please may I have a copy of your code so I
can
figure out what I've done wrong in mine. Mine works for everything,
except
for accessing this way.

Scott







Reply With Quote
  #4  
Old   
Wm. Scott Miller
 
Posts: n/a

Default Re: If you have a .NET Custom DTS Task please try this... - 10-26-2004 , 10:50 AM



Darren:

I worked on it and found that I had made a modification that broke the
disconnected view of my custom task. After fixing that, I found that the
actual syntax is as below:

oCustomTask.Properties.Item("MyProperty").Value

Additionally, if you follow Microsoft's suggestion to "return null" for the
Properties collection you get a "Object Required" error. You must implement
Properties as follows:

Properties oProps;
PropertiesProviderClass oPropProvider = new PropertiesProviderClass();
oProps = oPropProvider.GetPropertiesForObject(this);
oPropProvider = null;
return oProps;

Just thought I would let you and others reading this know.

So it appears that you cannot create your own methods on a custom task and
use them with .NET. Sounds like they went backwards on that one as every
other language I've used to write custom tasks works fine in the ActiveX
Script mode. I changed my method to a property that just runs and returns
that same information and I could access it the way you said. Looks like
the Microsoft documentation is incorrect (they also say the syntax you gave
will work and it doesn't--they provide both syntaxes right next to each
other in their HOW TO document and only one works) or at least they don't
make it known that accessing anything but Name and Description according to
their example doesn't work. Do you happen to know the reason for this not
working?

Thanks for your help,
Scott

"Wm. Scott Miller" <Scott.Miller (AT) spam (DOT) killer.wvinsurance.gov> wrote in
message news:OoWAzD2uEHA.4028 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Quote:
Darren:

Thanks for the reply!

I cut and pasted your code into my routine and all I get is errors.
Specifically, "Wrong number of arguments or invalid property assignment:
'oCustomTask.Properties'" Any ideas?

Scott

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote in
message
news:%23zEjMV0uEHA.1616 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Workaround is to use the properties collection, e.g.

oCustomTask.Properties("MyProperty").Value = "Fred"


--
Darren Green
http://www.sqldts.com

"Wm. Scott Miller" <Scott.Miller (AT) spam (DOT) killer.wvinsurance.gov> wrote in
message news:uajBoGtuEHA.1260 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Dear Custom DTS Task Writers:

If you have written a Custom DTS Task in .Net, please attempt to
modify
your
custom task within an ActiveX script. To do so, add your Custom DTS
Task
to
a new package, add an ActiveX Script Task, and set its code to similar
to
below:

Dim oPackage
Dim oCustomTask

set oPackage = DTSGlobalVariables.Parent
set oCustomTask = oPackage.Tasks("[Get the Tasks name from
disconnected
view and paste here]").CustomTask

oCustomTask.[CustomProperty] = "Hello World!" *OR*
oCustomTask.[CustomMethod]

Main = DTSTaskExecResult_Success

The Property or Method must be one you have added other than the ones
you
are required to include.......other than Name and Description.

If the script correctly runs, please may I have a copy of your code so
I
can
figure out what I've done wrong in mine. Mine works for everything,
except
for accessing this way.

Scott









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.