Re: ActiveX Script errors suppressed



Hi fsanchez

I've never actually tried to call GetExecutionErrorInfo in an ActiveX
script - I'm using VB. It would be great to be able to do this, but as
I found when researching my problem, it looks as though this isn't
possible. The quote below is from Darren Green - I wish he was wrong
about this but unfortunately for your problem he does know what he's
talking about!

See further below for possible workaround

>GetExecutionErrorInfo uses ByRef parameters to pass back the
information
>such as error description etc. These are type variables, long and
string
>etc. ActiveX Script only has the variant type. For ByRef to work the
>types must match exactly. Using CStr and similar only suppresses the
>error by ensuring the data passed in is type correctly, but does not
>change the variant to a true string. You will need to use a strongly
>type language. You could write a DLL in VB that could be called from
>ActiveX Script o even write a custom taks to do the entire error
capture
>job. Using a custom task gives reuse too, without copy and paste of
code
>between packages.
>
>--
>Darren Green (SQL Server MVP)
>DTS - http://www.sqldts.com

There may be a workaround to your problem, IF you can replace your
ActiveX script with a Run Package task. I've never tried to do this,
but you may well be able to set the child package's parameters (which
you do through the Package/Package2 object in your script) with a
Dynamic Properties task instead in the main package.
If you can use a Run Package task, then you could wrap the execution of
the main package in a VB wrapper (using pretty much the same code as
you use above), and add some extra-clever functionality to the
error-detection part of your code:

[can't remember the exact object model, so this is very pseudo]
For each Step in MainPackage
If Step.ExecutionStatus = [completed] and
Step.ExecutionResult=DTSStepExecResult_Failure Then
'[here call GetExecutionErrorInfo, as in your code]
[this line VERY pseudo - but I think you'll get what I mean]
If Step.Task.Customtask.TypeOfTask = [Execute Package task]
Then
Set ChildPackage = Step.Task.CustomTask.Package
For Each ChildStep in ChildPackage
[call GetExecutionErrorInfo]
Next
End if
End If
Next

you'd have to handle how the routine accumulates errors: I just set up
a strErrMsgs string, then each time I find an error, rather than
exiting, append the error info to the string, preceded by a CRLF if
there's anything already in the string. In this way the final string
contains every error detected (though of course responding to/trapping
an individual error becomes difficult or impossible - but then we are
dealing with DTS, the error-handler's black nightmare...).
To be really clever this procedure could be re-designed into a
recursive procedure, in case someone ever sets up a package which runs
a child package which runs a grandchild package which runs a
great-grandchild package....

I'm going to try out this approach, I'll post results as I go. If
anyone reads this and knows it can't possible work for some reason,
please do post knocking my idea down!

regards



Seb

.



Relevant Pages

  • Re: Using Python in ActiveX task - works when run as separate step
    ... I just used some simple script to test: ... I installed ActivePerl on my test machine, create a new DTS package, and a ... new ActiveX script task. ... |>>>You could execute the step in DTS package window. ...
    (microsoft.public.sqlserver.dts)
  • ActiveX tasks hangs in DTS.
    ... It appears that SQL Server has lost the ability to run an ActiveX Script ... In my production environment all DTS packages hang ... I've created a package with a connection and ...
    (microsoft.public.sqlserver.dts)
  • Re: SQL Server Agent Job vs Stored Packages
    ... The script starts another scriptwith Plink on the ... Dim RC As Boolean = start_dialogue_pl ... Dim myResponse As String = "" ... When you execute a package as a job, how do you see the tasks turn ...
    (microsoft.public.sqlserver.dts)
  • Re: SQL Server Agent Job vs Stored Packages
    ... The script starts another scriptwith Plink on the ... Dim RC As Boolean = start_dialogue_pl ... Dim myResponse As String = "" ... When you execute a package as a job, how do you see the tasks turn ...
    (microsoft.public.sqlserver.dts)
  • ActiveX Scripting Error 2147220482 (800403FE) in DTS package..
    ... I have a DTS package that is run from a web UI via xp_cmdshell and DTSRUN, ... I'm getting an Active X script error on one of my steps only when run ... Error string: ActiveX Scripting ... ...
    (microsoft.public.sqlserver.dts)