dbTalk Databases Forums  

GetExecutionErrorInfo Method Fails when executing

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


Discuss GetExecutionErrorInfo Method Fails when executing in the microsoft.public.sqlserver.dts forum.



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

Default GetExecutionErrorInfo Method Fails when executing - 04-21-2005 , 12:00 PM






Hi,
I am trying to determine if any of the step in package failed. I am
executing a package from within an ActiveX script. The execution of the
package works fine; however, when I try to retrieve the error information,
the call fails indicating Type missmatch or wrong number of arguments. Here
is the sample code...Can anyone help...

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer "(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute

'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION
'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode, sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536 Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", " &
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ", x" & _
Hex(iErrorCode And -65536) & " + " & CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & " failed, error:
" & _
sErrorNumConv & vbCrLf & sDescr & vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function


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

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-22-2005 , 05:02 AM






It won't work in script because it uses by reference arguments, which must
of the correct type, and you only have variant available, not the required
string and int types.

You will need to write this code in a full language. Implement it as a COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,
I am trying to determine if any of the step in package failed. I am
executing a package from within an ActiveX script. The execution of the
package works fine; however, when I try to retrieve the error information,
the call fails indicating Type missmatch or wrong number of arguments.
Here
is the sample code...Can anyone help...

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer "(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute

'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION
'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode, sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536 Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", " &
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ", x" & _
Hex(iErrorCode And -65536) & " + " & CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & " failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr & vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function




Reply With Quote
  #3  
Old   
fsanchez
 
Posts: n/a

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-22-2005 , 08:45 AM



Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge of
developing COM. Do you know how I can go about this or develop the COM object
and calling it from ActiveX script? Any insight greatly appreciate it.

"Darren Green" wrote:

Quote:
It won't work in script because it uses by reference arguments, which must
of the correct type, and you only have variant available, not the required
string and int types.

You will need to write this code in a full language. Implement it as a COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I am
executing a package from within an ActiveX script. The execution of the
package works fine; however, when I try to retrieve the error information,
the call fails indicating Type missmatch or wrong number of arguments.
Here
is the sample code...Can anyone help...

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer "(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute

'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION
'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode, sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536 Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", " &
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ", x" & _
Hex(iErrorCode And -65536) & " + " & CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & " failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr & vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function





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

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-22-2005 , 11:26 AM



Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments, which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I am
executing a package from within an ActiveX script. The execution of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script

'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer "(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute

'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION
'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536 Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", " &
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ", x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & " failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr & vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function







Reply With Quote
  #5  
Old   
fsanchez
 
Posts: n/a

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-22-2005 , 02:04 PM



Yes,
I have Visual Basic 6.0 installed...

"Darren Green" wrote:

Quote:
Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E4E2E57A-73D3-4980-996B-A30AB01534B7 (AT) microsoft (DOT) com...
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments, which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I am
executing a package from within an ActiveX script. The execution of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script

'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer "(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute

'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION
'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536 Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", " &
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ", x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & " failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr & vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function








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

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-26-2005 , 02:10 AM



Tools & Tasks
(http://www.sqldts.com/default.aspx?272)

DTS ActiveX Helper
http://www.sqldts.com/redir.aspx?45

A simple COM component which wraps the GetExecutionErrorInfo method using
variant types for returning data, compatible with ActiveX Script Tasks. Full
source code included (VB6).



Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote

Quote:
Yes,
I have Visual Basic 6.0 installed...

"Darren Green" wrote:

Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E4E2E57A-73D3-4980-996B-A30AB01534B7 (AT) microsoft (DOT) com...
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge
of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate
it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments,
which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as
a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I
am
executing a package from within an ActiveX script. The execution
of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of
arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script


'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer
"(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute


'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION

'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536
Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", "
&
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ",
x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & "
failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr &
vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function










Reply With Quote
  #7  
Old   
fsanchez
 
Posts: n/a

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-26-2005 , 08:55 AM



Hi Darren,
I am getting error while accessing the DTS ActiveX Helper webpage. The
error indicates that the web page does not exist.

"Darren Green" wrote:

Quote:
Tools & Tasks
(http://www.sqldts.com/default.aspx?272)

DTS ActiveX Helper
http://www.sqldts.com/redir.aspx?45

A simple COM component which wraps the GetExecutionErrorInfo method using
variant types for returning data, compatible with ActiveX Script Tasks. Full
source code included (VB6).



Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E6A76EAE-491A-4DB5-BC4E-3AC9DEE2B6D0 (AT) microsoft (DOT) com...
Yes,
I have Visual Basic 6.0 installed...

"Darren Green" wrote:

Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E4E2E57A-73D3-4980-996B-A30AB01534B7 (AT) microsoft (DOT) com...
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge
of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate
it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments,
which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as
a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I
am
executing a package from within an ActiveX script. The execution
of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of
arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script


'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer
"(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute


'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION

'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536
Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", "
&
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ",
x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & "
failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr &
vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function











Reply With Quote
  #8  
Old   
fsanchez
 
Posts: n/a

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-26-2005 , 03:57 PM



Hi Darren,
I managed to learn how to call a COM object from within an DTS ActiveX and
return the error message. There a lot involve in creating the COM object.
However, once you create it and register the COM object. I was able to call
it as followed:

Function Main()
Dim sErrorMessage
Dim sProcessName
Dim oDTS


sProcessName = "3002PCKG"
Set oDTS = CreateObject("DWConsole.Package")

sErrorMessage = oDTS.ExecutePackage(sProcessName)
MsgBox sErrorMessage
Set oDTS = Nothing

Main = DTSTaskExecResult_Success
End Function

Here is the VB Code:
Public Function ExecutePackage(ByVal pPackageName As String) As String

Dim oPackage As DTS.Package, oStep As DTS.Step
Set oPackage = New DTS.Package

Dim sServer As String, sUsername As String, sPassword As String
Dim sPackageName As String, sMessage As String
Dim lErr As Long, sSource As String, sDesc As String

' Set Parameter Values
sServer = "(local)"
sUsername = ""
sPassword = ""
sPackageName = pPackageName

' Load Package
oPackage.LoadFromSQLServer sServer, sUsername, sPassword, _
DTSSQLStgFlag_UseTrustedConnection, , , , sPackageName

' Set Exec on Main Thread
For Each oStep In oPackage.Steps
oStep.ExecuteInMainThread = True
Next

' Execute
oPackage.Execute

' Get Status and Error Message
For Each oStep In oPackage.Steps
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
oStep.GetExecutionErrorInfo lErr, sSource, sDesc
sMessage = sMessage & "Step """ & oStep.Name & _
""" Failed" & vbCrLf & _
vbTab & "Error: " & lErr & vbCrLf & _
vbTab & "Source: " & sSource & vbCrLf & _
vbTab & "Description: " & sDesc & vbCrLf & vbCrLf
End If
Next

ExecutePackage = sMessage

oPackage.UnInitialize

Set oStep = Nothing
Set oPackage = Nothing

' Display Results
'MsgBox sMessage

End Function





"Darren Green" wrote:

Quote:
Tools & Tasks
(http://www.sqldts.com/default.aspx?272)

DTS ActiveX Helper
http://www.sqldts.com/redir.aspx?45

A simple COM component which wraps the GetExecutionErrorInfo method using
variant types for returning data, compatible with ActiveX Script Tasks. Full
source code included (VB6).



Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E6A76EAE-491A-4DB5-BC4E-3AC9DEE2B6D0 (AT) microsoft (DOT) com...
Yes,
I have Visual Basic 6.0 installed...

"Darren Green" wrote:

Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E4E2E57A-73D3-4980-996B-A30AB01534B7 (AT) microsoft (DOT) com...
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge
of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate
it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments,
which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as
a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I
am
executing a package from within an ActiveX script. The execution
of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of
arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script


'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer
"(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute


'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION

'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536
Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", "
&
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ",
x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & "
failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr &
vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function











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

Default Re: GetExecutionErrorInfo Method Fails when executing - 04-26-2005 , 05:25 PM



As you now know, my mistake, and now fixed.

In message <333B5400-62DA-41EE-A999-6196D14B52C5 (AT) microsoft (DOT) com>,
fsanchez <fsanchez (AT) discussions (DOT) microsoft.com> writes
Quote:
Hi Darren,
I am getting error while accessing the DTS ActiveX Helper webpage. The
error indicates that the web page does not exist.

"Darren Green" wrote:

Tools & Tasks
(http://www.sqldts.com/default.aspx?272)

DTS ActiveX Helper
http://www.sqldts.com/redir.aspx?45

A simple COM component which wraps the GetExecutionErrorInfo method using
variant types for returning data, compatible with ActiveX Script Tasks. Full
source code included (VB6).



Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E6A76EAE-491A-4DB5-BC4E-3AC9DEE2B6D0 (AT) microsoft (DOT) com...
Yes,
I have Visual Basic 6.0 installed...

"Darren Green" wrote:

Do you have a compiler/IDE, VB for example?

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:E4E2E57A-73D3-4980-996B-A30AB01534B7 (AT) microsoft (DOT) com...
Hi Darren,
I very greatful for your respond. Unfortunately, I have no knowledge
of
developing COM. Do you know how I can go about this or develop the COM
object
and calling it from ActiveX script? Any insight greatly appreciate
it.

"Darren Green" wrote:

It won't work in script because it uses by reference arguments,
which
must
of the correct type, and you only have variant available, not the
required
string and int types.

You will need to write this code in a full language. Implement it as
a
COM
object and you can leverage it from VBScript though.


Darren Green
http://www.sqldts.com
http://www.sqlis.com

"fsanchez" <fsanchez (AT) discussions (DOT) microsoft.com> wrote in message
news:0C5106FA-6A9C-496C-942B-624DE537664A (AT) microsoft (DOT) com...
Hi,
I am trying to determine if any of the step in package failed. I
am
executing a package from within an ActiveX script. The execution
of
the
package works fine; however, when I try to retrieve the error
information,
the call fails indicating Type missmatch or wrong number of
arguments.
Here
is the sample code...Can anyone help...


'************************************************* *********************
' Visual Basic ActiveX Script


'************************************************* ***********************

Function Main()
Dim ADOconn
Dim ADOrst
Dim oPackage
Dim oStep
Dim iErrorCode
Dim iCount
Dim sTaskName
Dim sSource
Dim sErrorDesc
Dim sHelpFileName
Dim iHelpContextID
Dim sInterfaceID
Dim sErrorMessage
Dim sErrorNumConv
Dim sProcessCategory
Dim sProcessName

Set oPackage = CreateObject("DTS.Package")

sProcessName = "3002PCKG"

oPackage.LoadFromSQLServer
"(local)","","","256",,,,sProcessName
oPackage.GlobalVariables.Item("giJobID").Value =
DTSGlobalVariables("giJobID").Value
oPackage.GlobalVariables.Item("gsAS400SourceUDL"). Value =
DTSGlobalVariables("gsAS400SourceUDL").Value
oPackage.GlobalVariables.Item("gsSourceUDL").Value =
DTSGlobalVariables("gsSourceUDL").Value
oPackage.GlobalVariables.Item("gsTargetUDL").Value =
DTSGlobalVariables("gsTargetUDL").Value

oPackage.Execute


'************************************************* *************
' GET STATUS AND ERROR
'************************************************* *************

'LOOK FOR STEPS THAT COMPLETED AND FAILED.
For iCount = 1 To oPackage.Steps.Count

If oPackage.Steps(iCount).ExecutionStatus =
DTSStepExecStat_Completed Then

If oPackage.Steps(iCount).ExecutionResult =
DTSStepExecResult_Failure Then


'************************************************* *************
'GET THE STEP ERROR INFORMATION

'************************************************* *************

iErrorCode = CLng(-1)
iHelpContextID = CLng(-1)

oPackage.Steps(iCount).GetExecutionErrorInfo iErrorCode,
sSource,
sErrorDesc, sHelpFileName, iHelpContextID, sInterfaceID

If iErrorCode < 65536 And iErrorCode > -65536
Then

sErrorNumConv = "x" & Hex(iErrorCode) & ", "
&
CStr(iErrorCode)

Else

sErrorNumConv = "x" & Hex(iErrorCode) & ",
x" &
_
Hex(iErrorCode And -65536) & " + " &
CStr(iErrorCode
And 65535)

End If

sMessage = sMessage & vbCrLf & _
"Step " & oPackage.Steps.Name & "
failed,
error:
" & _
sErrorNumConv & vbCrLf & sDescr &
vbCrLf
End If
End If
Next

Msgbox sMessage

oPackage.Uninitialize()
Set oPackage = Nothing

Main = DTSTaskExecResult_Success
End Function










--
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
  #10  
Old   
Tom P
 
Posts: n/a

Default Re: GetExecutionErrorInfo Method Fails when executing - 05-17-2005 , 03:41 PM



Darren,

I have downloaded that zip file, and registered the ActiveXHelper DLL as a
COM
object, but still can't get the function to work within a script. Can
you maybe tell me what I'm doing wrong? Here's a code
snippet:

dim objStepError
Set objStepError = CreateObject("DTSActiveXHelper.HelperClass")

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.