General discussion


DTS packages conversion from VB 6 to VB .NET

By Farmac ·
I am having great difficulty fixing this error

I have done all of the conversions necessaries from VB 6.0 to VB .NET. After the DTS in converted I try to run it and I keep getting an error. The error is as follow:

System.InvalidCastException has ocurred at XXXXXX.exe
Specifically in the code at:
oCustomTask1 = oTask.CustomTask
QueryInterface for interface DTS.CustomTask failed

I research and I found out the I need to install SQL Server client tools and have install SQL Service 2000 Service Pack 3
here is more code:
Public Sub Task_Sub1(ByVal goPackage As DTS.Package2)
Dim DTS As Object

Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup
Dim oCustomTask1 As DTS.DataPumpTask2
oTask = goPackage.Tasks.New("DTSDataPumpTask")
oCustomTask1 = oTask.CustomTask (ERROR)

oCustomTask1.Name = "Copy Data from BOL_CLEVELAND_FINAL to [Marketing].[dbo].[BOL_CLEVELAND_FINAL1] Task"
oCustomTask1.Description = "Copy Data from FINAL to [Mark].[dbo].[FINAL1] Task"
oCustomTask1.SourceConnectionID = 1
oCustomTask1.SourceSQLStatement = "select `Field5`,`Field2`,`ACCOUNT,`INDEX` from `FINAL`"
oCustomTask1.DestinationConnectionID = 2
oCustomTask1.DestinationObjectName = "[Mark].[dbo].[FINAL1]"
oCustomTask1.ProgressRowCount = 1000
oCustomTask1.MaximumErrorCount = 0
oCustomTask1.FetchBufferSize = 1
oCustomTask1.UseFastLoad = True
oCustomTask1.InsertCommitSize = 0
oCustomTask1.ExceptionFileColumnDelimiter = "|"
oCustomTask1.ExceptionFileRowDelimiter = vbCrLf
oCustomTask1.AllowIdentityInserts = False
oCustomTask1.FirstRow = 0
oCustomTask1.LastRow = 0
oCustomTask1.FastLoadOptions = 2
oCustomTask1.ExceptionFileOptions = 1
oCustomTask1.DataPumpOptions = 0

Call oCustomTask1_Trans_Sub1(oCustomTask1)
oCustomTask1 = Nothing
oTask = Nothing

End Sub
thanks in advance

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums