DTS Memory Violation under VB6 - SqlServer 7 -
11-04-2003
, 11:11 AM
I recently replaced 1500 lines of older VB code (some of it faulty) with 3
DTS packages
under SQL Server 7 - All service packs are up to date (VB and SQL): I am
getting errors
when running the package under VB6. I'd be very appreciate if someone more
experienced
in DTS from VB could take a peek and let me in on what needs to be done
here - thanks!
One more question. The package manager has trouble creating an installer
that will correctly
install the app on a target machine - I did manage to get one builtby hand
though - any hints
on that one?
The packages are in the following format.
Package_All
Invoke Package_Step_01
Invoke Package_Step_02
Package Step_01 and (02) are both DTS Packages invokes from the toplevel
package.
The problem is that when running the toplevel package under VB is that *
sometimes *, usually
the first time the package is run, I get a memory access violation that
closes the application down.
The error occurs after the _OnFinish event has fired.
Do I need to recurse down into packages and insure that each has
"ExecuteInMainThread = True"
set, or is everything fine thge way it is.
This is the first timer I have converted VB code into DTS and I would like
to solve alot more of
my companies problems this way, but not if it is going to explode when it
runs.
The sum total of my Form Based test code follows:
*** BEGIN CODE ***
Option Explicit
Dim WithEvents oPkg As DTS.Package2
Dim oStep As DTS.Step
Private Sub Command1_Click()
Set oPkg = New DTS.Package
oPkg.LoadFromSQLServer "oursql", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "Package_All"
oPkg.AutoCommitTransaction = True
For Each oStep In oPkg.Steps
oStep.ExecuteInMainThread = True
Next
On Error Resume Next
oPkg.Execute
oPkg.UnInitialize
Set oPkg = Nothing
End Sub
Private Sub oPkg_OnError(ByVal EventSource As String, ByVal ErrorCode As
Long, ByVal Source As String, ByVal Description As String, ByVal HelpFile As
String, ByVal HelpContext As Long, ByVal IDofInterfaceWithError As String,
pbCancel As Boolean)
Me.Caption = "ERROR"
DoEvents
End Sub
Private Sub oPkg_OnFinish(ByVal EventSource As String)
Me.Caption = "All Done!"
End Sub
Private Sub oPkg_OnProgress(ByVal EventSource As String, ByVal
ProgressDescription As String, ByVal PercentComplete As Long, ByVal
ProgressCountLow As Long, ByVal ProgressCountHigh As Long)
Me.Caption = "Progress, " & PercentComplete
DoEvents
End Sub
Private Sub oPkg_OnStart(ByVal EventSource As String)
Me.Caption = "Started..."
DoEvents
End Sub
*** END CODE **** |