Set oConnection = Nothing End Sub
''''以下是出错处理 Private Function ErrorNumConv(ByVal lngErrNum As Long) As String
If lngErrNum < 65536 And lngErrNum > -65536 Then ErrorNumConv = "x" & Hex(lngErrNum) & ", " & CStr(lngErrNum) Else ErrorNumConv = "x" & Hex(lngErrNum) & ", x" & _ Hex(lngErrNum And -65536) & " + " & CStr(lngErrNum And 65535) End If
End Function
Private Function AccumStepErrors(ByRef oPackage As DTS.Package) As String Dim oStep As DTS.Step Dim strMessage As String Dim lngErrNum As Long Dim strDescr As String Dim strSource As String
''''查找出错地 For Each oStep In oPackage.Steps If oStep.ExecutionStatus = DTSStepExecStat_Completed Then If oStep.ExecutionResult = DTSStepExecResult_Failure Then ''''得到出错信息 oStep.GetExecutionErrorInfo lngErrNum, strSource, strDescr strMessage = strMessage & vbCrLf & _ "Step " & oStep.Name & " failed, error: " & _ ErrorNumConv(lngErrNum) & vbCrLf & strDescr & vbCrLf End If End If Next AccumStepErrors = strMessage
End Function
以上代码在win2k pro + sql2k下调试通过。
本人在学习DTS的过程中参考了大量的SQL自带的sample代码,确实收获不小,特此撰文,给朋友们做为一点参考,我想在以后的时间里尽可能地多总结一下自己在学习应用过程中的心得体会,希望与大家多交流,也希望大家接受点批评指正。
minajo21(大眼睛)
上一页 [1] [2] |