Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

 

I do not not want could it be. Thanks for your help in advance

  • Moderators
Posted

I just tried it out and you need to make a few changes...

 

I have not run the following, but it should work.

oConnection = goPackage.Connections.New("DTSFlatFile")

'change this....
       oConnection.ConnectionProperties("Data Source") = "C:\test.txt"

'to this....
oConnection.ConnectionProperties.Item("Data Source").Value = "C:\test.txt"

Visit...Bassic Software
Posted

I already did those changes but I am still having the same problems that I had before:

 

System.InvalidCastException has ocurred at XXXXXX.exe

Specifically in the code at:

oCustomTask1 = oTask.CustomTask

QueryInterface for interface DTS.CustomTask failed

 

On one article that I read it said that I need it to get SQL Server service Pack 3 for the server and also Service Pack 3 for desktop.

After doing all that I am still having the same problem. I have been struggling with this for quite a while. I am going to post more code to see if it help:

 

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)

goPackage.Tasks.Add(oTask)

oCustomTask1 = Nothing

oTask = Nothing

 

End Sub

 

It looks to me as if it is one of those default problem when converting from VB 6 to .NET

thanks

Posted

I have update with SP 3 on the desktop as well, but I am still having the same problem as before

I do not know if this have something to do with it, nut he desktop computer have install SQL Server with the client tools. AS I said before I have update the desktop with SP 3 for desktop. I am still showing the same problem

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...