dbTalk Databases Forums  

Custom Task using DTS.Connection

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


Discuss Custom Task using DTS.Connection in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jlcaesar@gmail.com
 
Posts: n/a

Default Custom Task using DTS.Connection - 03-13-2006 , 12:37 PM






I am writing a custom task (in C#) to add some additional behavior to
the ExecuteSqlTask2 object. I am using the CustomTask and
ExecuteSQLTask2 interfaces , and have the various properties and
methods setup or atleast stubbed out, etc.

I want to write the guts of the execute method. I have a
System.Data.SqlClient.SqlCommand I want to use, but it requires a
System.Data.SqlClient.SqlConnection. DTS has a collection of
Microsoft.SQLServer.DTSPkg80.Connection items, which the SqlCommand
can't use.

I could create a new SqlConnection from the DTS connection properties,
but this doesn't seem very clean, and the password is write only
anyway.

Does anyone have any sample code that uses the package's
Microsoft.SQLServer.DTSPkg80.Connection object directly (any language,
I just need an idea of how its done) ?


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

Default Re: Custom Task using DTS.Connection - 03-14-2006 , 01:10 AM






The OLE-DB connections used by DTS cannot be consumed like this in managed
code. An OLE-DB connection is different to a managed SqlConnection. To
consume OLE-DB connections you need to write OLE-DB code, to consume managed
connections, well you know already obviously.

If you want extensibility then SSIS is much better, but even then you cannot
consume OLE-DB connections when using managed code like this. You can
however use fully managed connections instead that can do OLE-DB as well.


<jlcaesar (AT) gmail (DOT) com> wrote

Quote:
I am writing a custom task (in C#) to add some additional behavior to
the ExecuteSqlTask2 object. I am using the CustomTask and
ExecuteSQLTask2 interfaces , and have the various properties and
methods setup or atleast stubbed out, etc.

I want to write the guts of the execute method. I have a
System.Data.SqlClient.SqlCommand I want to use, but it requires a
System.Data.SqlClient.SqlConnection. DTS has a collection of
Microsoft.SQLServer.DTSPkg80.Connection items, which the SqlCommand
can't use.

I could create a new SqlConnection from the DTS connection properties,
but this doesn't seem very clean, and the password is write only
anyway.

Does anyone have any sample code that uses the package's
Microsoft.SQLServer.DTSPkg80.Connection object directly (any language,
I just need an idea of how its done) ?




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.