I have been able to get a DTS package from a VB6 app to
run in VB.Net. After you run the upgrade wizard you just
need to cast a few items like this:
Public Sub Main()
'--these are the items I had to change/CType in Sub Main
'--Note: I left a few of the old statements but commented
'--them out. Anywhere you see a CType - that is a change
'--So just look for where VB.Net is complaining in your
'--package and that is where you have to Cast/CType
'goPackage = goPackageOld
goPackage = CType(goPackageOld, DTS.Package2)
goPackage.PackagePriorityClass = CType(2,
DTS.DTSPackagePriorityClass)
goPackage.TransactionIsolationLevel = CType(4096,
DTS.DTSIsolationLevel)
'goPackage.Connections.Add(oConnection)
goPackage.Connections.Add(CType(oConnection,
DTS.Connection))
'goPackage.Connections.Add(oConnection)
goPackage.Connections.Add(CType(oConnection,
DTS.Connection))
oStep = CType(goPackage.Steps.New, DTS.Step2)
oStep.ExecutionStatus = CType(1, DTS.DTSStepExecStatus)
oStep.RelativePriority = CType(3,
DTS.DTSStepRelativePriority)
tracePackageError(CType(goPackage, DTS.Package))
End Sub
'-----------------------------------------------
Public Sub tracePackageError(ByRef oPackage As DTS.Package)
....
For i = 1 To CType(oPackage.Steps.Count, Short)
If oPackage.Steps.Item(i).ExecutionResult =
DTS.DTSStepExecResult.DTSStepExecResult_Failure Then
oPackage.Steps.Item
(i).GetExecutionErrorInfo(ErrorCode, ErrorSource,
ErrorDescription, ErrorHelpFile, ErrorHelpContext,
ErrorIDofInterfaceWithError)
MsgBox(oPackage.Steps.Item(i).Name & "
failed" & vbCrLf & ErrorSource & vbCrLf & ErrorDescription)
End If
Next i
End Sub
'-----------------------------------------------------
Public Sub Task_Sub1(ByVal goPackage As Object)
'oTask = goPackage.Tasks.New("DTSDataPumpTask")
oTask = CType(goPackage, DTS.Package).Tasks.New
("DTSDataPumpTask")
'oCustomTask1 = oTask.CustomTask
oCustomTask1 = CType(oTask.CustomTask, DTS.DataPumpTask2)
oCustomTask1.FastLoadOptions = CType(2,
DTS.DTSFastLoadOptions)
oCustomTask1.ExceptionFileOptions = CType(1,
DTS.DTSExceptionFileOptions)
'goPackage.Tasks.Add(oTask)
CType(goPackage, DTS.Package).Tasks.Add(oTask)
End Sub
'--------------------------------------------------------
Public Sub oCustomTask1_Trans_Sub1(ByVal oCustomTask1 As
Object)
'oTransformation = oCustomTask1.Transformations.New
("DTS.DataPumpTransformCopy")
oTransformation = CType(CType(oCustomTask1,
DTS.DataPumpTask2).Transformations.[New]
("DTS.DataPumpTransformCopy"), DTS.Transformation2)
'---here is where you deal with the data you are copying
'---and at the end of that is your last Cast/CType
'oCustomTask1.Transformations.Add(oTransformation)
CType(oCustomTask1,
DTS.DataPumpTask2).Transformations.Add(oTransforma tion)
'--End of Package
End Sub
HTH
Ron
Quote:
-----Original Message-----
Hi all!
I have created a dts package with SQL 2000 SP3a hotfix
818.
I saved it as bas file and imported in my VB.NET service;
I then fixed the small issues remaining with VB6->VB.NET
|
translations.
Quote:
The service compile file and works for a while than
crashes without notice.
The debugger says that there is no code line to show but
only assembly: seems to crash outside my code, somewhere
|
in the CLR !!!
Quote:
I then created a lot of breakpoints and found that the
problematic functions are:
Call oCustomTask1_Trans_SubXX(oCustomTask1)
where XX is everytime different ( I have 29
transformations ).
Can anyone give me an idea on how to identify the problem
and then fix it ?
Thank you in advance for any answer,
Simone |