Solved

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

Posted on 2004-08-27
3
712 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 55
need to convert function to c# 5 45
How to repeat the data 4 30
aspx ascx, c# 7 19
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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