Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C# throws Query Interface exception when casting to DTS.DataPumpTask

Posted on 2004-08-27
3
Medium Priority
?
717 Views
Last Modified: 2011-09-20
.NET/C#/SQL-Server Experts:

I created a sample DataPump Package using the DTS GUI in Enterprise manager and exported it to VBScript.   I put it  in a VB6 project and it worked fine.

VB6 codefrag:

    Dim oTask           As DTS.Task
    Dim oBulkDataPump   As DTS.DataPumpTask

... Package & Step creation omitted...  

    Set oTask = oPackage.Tasks.New("DTSDataPumpTask")
    Set oBulkDataPump = oTask.CustomTask

...Properties, Transformation and execution stuff omitted....

The above code works fine.

I converted it to C# solution.

C# codefrag:

DTS.Task  task= mPkg.Tasks.New( "DTSDataPumpTask");
DTS.DataPumpTask pump = (DTS.DataPumpTask)task.CustomTask;

....setting DTS.DataPumpTask properties omitted....

At *runtime, the above code throws a Query interface exception when creating the pump;

Upon examining the DTS.DataPumpTask interface, sure enough, it does not extend DTS.CustomTask.  And certainly DTS.CustomTask does not extend DTS.DataPumpTask.  

What do I have to add to my C# code to make it behave like the old VB6 code?  Somehow I feel I need a different mechanism to get the correct interface than class casting.

The Project references I've added are to the version 2 of the DTS com libraries.  The interop client callable wrapper dlls are in my bin directory.  And everything compiles cleanly.

What am I missing?

Thanks in advance

Brad




0
Comment
Question by:blekros
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:blekros
ID: 12019196
Nevermind.  Question withdrawn.  The answer is install SQLServer Service Pack 3a
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 12142519
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question