dbTalk Databases Forums  

DTS Memory Violation under VB6 - SqlServer 7

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Memory Violation under VB6 - SqlServer 7 in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew
 
Posts: n/a

Default 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 ****



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: DTS Memory Violation under VB6 - SqlServer 7 - 11-06-2003 , 01:28 PM






Most likely a threading issue at the root of this. Have you seen these
articles as well-

PRB: Cannot Use DTS Events in VB with Execute Package Task (319048)
http://support.microsoft.com/?kbid=319048

"Restructure your DTS Packages and Tasks and do not use parent DTS
packages that use the Execute Package task to call child DTS packages."
- Use an ActiveX SCript Task instead.


Using SQL Server DTS with Visual Basic: Resources and Known Issues
(http://www.sqldts.com/default.aspx?258)



--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.