After the upgrade is done you can't simply compile the new project and run it. You'll get compiler errors that must be fixed. The rest of this article will dig into four types of issues:
How to fix the compiler errors
There are three errors that must be resolved before you can run the DTS package in the .NET environment. Fixing these problems should take no more then 10 minutes.
Compiler error #1 Argument not specified
Change:
tracePackageError(goPackage.Steps.Item)
To:
tracePackageError(goPackage)
TracePackageError() takes a DTSPackage as an input argument, but the code that was generated tries to pass a Step object. Simply changing the argument to the container package solves the problem and allows the tracePackageError method to correctly walk through all the steps of the package.
Compiler error #2 and #3: Constructor call is valid
only as the first statement in an instance constructor
The error message is a misleading. The solution is.
Change:
Public Sub Task_Sub1(ByVal
goPackage As Object)
:
oTask =
goPackage.Tasks.New("DTSDataPumpTask")
To:
Public Sub Task_Sub1(ByVal
goPackage As DTS.Package2)
:
oTask =
goPackage.Tasks.New("DTSDataPumpTask")
Both cases occur because a formal parameter is declared as a generic "Object." In Visual Basic 6.0 this worked because it took advantage of the default property that could be used as a shortcut in the code. Visual Basic .NET no longer supports the default property. The simple solution is to replace the "Object" formal parameter with the actual object required.
Contents