Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now