|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Error automating DTS Package from VB6 to VB.NETcomplies fine but then I get this error message: An unhandled exception of type 'System.InvalidCastException' occurred in Project1.exe Additional information: QueryInterface for interface DTS.CustomTask failed. This is the portion of the code that it is breaking on: I found 2 ways to do this but both ways are giving me the same error message Way #1: Public Sub Task_Sub1(ByVal goPackage As DTS.Package2) Dim oTask As DTS.Task Dim oLookup As DTS.Lookup Dim oCustomTask1 As DTS.DataPumpTask2 oTask = CType(goPackage, DTS.Package2).Tasks.New("DTSDataPumpTask") oTask = goPackage.Tasks.New("DTSDataPumpTask") oCustomTask1 = oTask.CustomTask Way #2: Public Sub Task_Sub1(ByVal goPackage As Object) Dim oTask As DTS.Task Dim oLookup As DTS.Lookup Dim oCustomTask1 As DTS.DataPumpTask2 oTask = CType(goPackage, DTS.Package2).Tasks.New("DTSDataPumpTask") oCustomTask1 = oTask.CustomTask If anyone has an idea on what I need to change in the code I would greatly appreciate it. Thanks in advance |
|||||||||||||||||||||||