Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why, and when, to use Windows Workflow 1 31
Parse the OuterHTML Data in the txtfile using c# 4 47
Runtime Error 2 28
ASP.NET 5 Templates 2 65
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

18 Experts available now in Live!

Get 1:1 Help Now