VB 6.0 DTS to VB.NET?

VB 6.0 DTS to VB.NET?

Post by News for AB » Sun, 04 Aug 2002 06:05:45



In Visual Basic 6.0 when I open up a DTS Task Saved to VB .bas file I get
the following code...

Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup

Dim oCustomTask1 As DTS.DataPumpTask2
Set oTask = goPackage.Tasks.New("DTSDataPumpTask")
Set oCustomTask1 = oTask.CustomTask

I copied it and all the other code into my VB.NET application and this like
causes a "Constructor call is valid only as the first statement in an
instance constructor." message.  How exactly can I convert this into
something that is acceptable to VB.NET?

Thanks for any assistance.

ABH

 
 
 

VB 6.0 DTS to VB.NET?

Post by yan wang [M » Tue, 06 Aug 2002 11:54:11


Hi,
You may modify your DTS Code referring below:
---------
Message: "Constructor call is valid only as the first statement in an
instance constructor"
Occurs on a line such as:
        oTask = goPackage.Tasks.New("DTSExecuteSQLTask")
Comments: Actually a type-casting issue
Solution - Ctype:
        oTask = CType(goPackage, DTS.Package).Tasks.New("DTSExecuteSQLTask")
Also occurs on:
        oTransformation =
oCustomTask3.Transformations.New("DTS.DataPumpTransformCopy")
Solution:
        oTransformation = CType(oCustomTask3,
DTS.DataPumpTask2).Transformations.New("DTS.DataPumpTransformCopy")
--------------------------
HTH,
Regards,
Yan
***This posting is provided 'AS IS' with no warranties, and confers no
rights.*****

 
 
 

1. VB 6.0 to VB.NET issue.

In Visual Basic 6.0 when I open up a DTS Task Saved to VB .bas file I get
the following code...

Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup

Dim oCustomTask1 As DTS.DataPumpTask2
Set oTask = goPackage.Tasks.New("DTSDataPumpTask")
Set oCustomTask1 = oTask.CustomTask

I copied it and all the other code into my VB.NET application and this like
causes a "Constructor call is valid only as the first statement in an
instance constructor." message.  How exactly can I convert this into
something that is acceptable to VB.NET?

Thanks for any assistance.

ABH

2. Flickers filling the TreeView Control

3. DTS VB 6.0 code to .NET (Upgrade Wizard)

4. Problem with text data type

5. VB 6.0 - Visual FoxPro 6.0 Tables and VB

6. Connect to Personal Oracle 8

7. Passing Data from VC 6.0 to VB.NET

8. Run DTS Import automatic

9. VS.NET effects VB 6.0 ADO 2.7 context-sensitive help

10. VB 3.0 TO VB 6.0

11. Upgrade to VB 5.0 or VB 6.0?

12. VB 7.0 Insert Queries and VB 6.0

13. VB 5.0 vs. VB 6.0 - ASP.DLL