Solved

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

Posted on 2004-08-27
3
711 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

837 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