Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 COM Type Mismatch DTS Step.GetExecutionErrorInfo

Author  Topic 

Kindred
Starting Member

2 Posts

Posted - 2004-12-08 : 01:20:51
I'm trying to get detailed information from executing an DTS Package but when I attempt to call GetExecutionErrorInfo it always gives me a type mismatch error. Any ideas?

Here's the code I'm using...

Dim lErrNum As Long
Dim sSource As String
Dim sDescr As String

For Each oStep In oPackage.Steps
If oStep.ExecutionStatus = 4 Then 'DTSStepExecStat_Completed
If oStep.ExecutionResult = 1 Then 'DTSStepExecResult_Failure
'----- get step error info, append to message

oStep.GetExecutionErrorInfo(lErrNum, sSource, sDescr)
^--- Error occurs here, COM Type Mismatch

sMessage &= vbCrLf & _
"Step '" & oStep.Name & "' failed, error: " & _
ErrorNumConv(lErrNum) & vbCrLf & sDescr & vbCrLf
End If
End If
Next

I've also tried converting sSource and sDescr to a BStr using the Marshal.StringToBStr as well as using a Long instead of an integer for the lErrNum.

Kindred
Starting Member

2 Posts

Posted - 2004-12-08 : 22:19:22
Ok I've figured it out. I thought I tried passing in an integer but I actually only tried a Long and an object. I never tried an Integer. That's what fixed the error. Maybe I'm reading the documentation wrong but I would think it would tell me the correct type to pass in. Here's what the documenation said...

HRESULT GetExecutionErrorInfo(
long *pErrorCode,
BSTR *pbstrSource,
BSTR *pbstrDescription,
BSTR *pbstrHelpFile,
long *pHelpContext,
BSTR *pbstrIDofInterfaceWithError);

To me it seems as though pErrorCode is of type long, shouldnt of it said type int?

Anyway, for anyone else who's trying to do this in .Net, make sure you pass pErrorCode in as an integer.
Go to Top of Page
   

- Advertisement -