DTS from VB.NET? oCustomTask1 = oTask.CustomTask error

DTS from VB.NET? oCustomTask1 = oTask.CustomTask error

Post by Marcos Bec » Fri, 01 Apr 2005 07:38:50


Hello to all.. (sorry but my english in that good)

I read avrey article on how to execute the old VB6 DTSPACKAGE and everything
goes well but this line is not working.
oCustomTask1 = oTask.CustomTask
An unhandled exception of type 'System.InvalidCastException' occurred in
Gman.exe
Additional information: Conversion is invalid

I installed the SQL SERVER 2000 SERVICE PACK 3a in the local MSDE and in the
server.

I converted the type explicitly
oCustomTask1 = CType(oTask.CustomTask,
DTS.ExecuteSQLTask2)
same error

Please.. I need to solve this urgently.. thank you very much to all..
Here is the code so you can test it...

http://www.yqcomputer.com/

Thank you again!
Manekurt
 
 
 

DTS from VB.NET? oCustomTask1 = oTask.CustomTask error

Post by Darren Gre » Fri, 01 Apr 2005 21:08:22

Your cast does not match the destination variable type. The oCustomTask1
variable type is TransferObjectsTask2, not ExecuteSQLTask2 which is what you
are creating. The type, create and cast must all match.


--
Darren Green
http://www.yqcomputer.com/
http://www.yqcomputer.com/



everything
the

 
 
 

DTS from VB.NET? oCustomTask1 = oTask.CustomTask error

Post by Marcos Bec » Fri, 01 Apr 2005 23:43:37

Hi Darren, thank you for your help, but I really tried EVERYTHING I could,
so your help is very helpfull.
I changed the Ctype to TransferObjectsTask2 and it returns the same error.



ERROR:
An unhandled exception of type 'System.InvalidCastException' occurred in
Gman.exe
Additional information: La conversi especificada no es vida.


NEW CODE:
Public Sub Task_Sub1(ByVal goPackage As Object)
Dim DTS As Object
System.Windows.Forms.Application.DoEvents() :
System.Windows.Forms.Application.DoEvents() :
System.Windows.Forms.Application.DoEvents() :
System.Windows.Forms.Application.DoEvents()
Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup
Dim oCustomTask1 As DTS.TransferObjectsTask2
oTask = CType(goPackage, DTS.Package).Tasks.New("DTSExecuteSQLTask")
oCustomTask1 = CType(oTask.CustomTask, DTS.TransferObjectsTask2)


Thank you again!







"Darren Green" < XXXX@XXXXX.COM > escribien el
>> Your cast does not match the destination variable type. The oCustomTask1 >> variable type is TransferObjectsTask2, not ExecuteSQLTask2 which is what >> you >> are creating. The type, create and cast must all match. >> >> >> -- >> Darren Green >> http://www.yqcomputer.com/ >> http://www.yqcomputer.com/ >>

>>> Hello to all.. (sorry but my english in that good) >>> >>> I read avrey article on how to execute the old VB6 DTSPACKAGE and >> everything >>> goes well but this line is not working. >>> oCustomTask1 = oTask.CustomTask >>> An unhandled exception of type 'System.InvalidCastException' occurred in >>> Gman.exe >>> Additional information: Conversion is invalid >>> >>> I installed the SQL SERVER 2000 SERVICE PACK 3a in the local MSDE and in >> the >>> server. >>> >>> I converted the type explicitly >>> oCustomTask1 = CType(oTask.CustomTask, >>> DTS.ExecuteSQLTask2) >>> same error >>> >>> Please.. I need to solve this urgently.. thank you very much to all.. >>> Here is the code so you can test it... >>> >>> http://www.yqcomputer.com/ >>> >>> Thank you again! >>> Manekurt >>> >>> >> >>
 
 
 

DTS from VB.NET? oCustomTask1 = oTask.CustomTask error

Post by Darren Gre » Sat, 02 Apr 2005 17:43:36

See you other post....

No need to start a new thread.

Cheers

Darren



>>>> Your cast does not match the destination variable type. The oCustomTask1 >>>> variable type is TransferObjectsTask2, not ExecuteSQLTask2 which is what >>>> you >>>> are creating. The type, create and cast must all match. >>>> >>>> >>>> -- >>>> Darren Green >>>> http://www.yqcomputer.com/ >>>> http://www.yqcomputer.com/ >>>>

>>>>> Hello to all.. (sorry but my english in that good) >>>>> >>>>> I read avrey article on how to execute the old VB6 DTSPACKAGE and >>>> everything >>>>> goes well but this line is not working. >>>>> oCustomTask1 = oTask.CustomTask >>>>> An unhandled exception of type 'System.InvalidCastException' occurred
in >>>>> Gman.exe >>>>> Additional information: Conversion is invalid >>>>> >>>>> I installed the SQL SERVER 2000 SERVICE PACK 3a in the local MSDE and
in >>>> the >>>>> server. >>>>> >>>>> I converted the type explicitly >>>>> oCustomTask1 = CType(oTask.CustomTask, >>>>> DTS.ExecuteSQLTask2) >>>>> same error >>>>> >>>>> Please.. I need to solve this urgently.. thank you very much to all.. >>>>> Here is the code so you can test it... >>>>> >>>>> http://www.yqcomputer.com/ >>>>> >>>>> Thank you again! >>>>> Manekurt >>>>> >>>>> >>>> >>>> >> >>