Returning from a DTS FTPTask Error -
01-26-2005
, 09:31 AM
I've created a package that uses an FTPTask to move files around the local
network. This is just for testing purposes and when I get the FTP server
information I will be pushing files to a FTP server.
So within my package I call the FTPTask and an ExecuteSQLTask within
ActiveXTask (below). So first of all the FTPTask is executed and if it
returns an error a global variable is updated with the error message else the
message says "successfull" and is used as a param in a stored proc in the
ExecuteSQLTask and ultimately writes a row to a log table.
However when I run this the FTP task does not appear to quit and the
ExecuteSQLTask is therefore not executed when there is an error (i.e.
directory doesn't exist). However when there is no errors the ExecuteSQLTask
executes fine and the row is written to the log.
Any help appreciated.
Thanks Darren
Function Main()
'For error logging
On Error Resume Next
'Setup reference to logging task
Dim pkg 'Package
Dim stpFTP 'FTP step
Dim stpLog 'Logging Step
Set pkg = DTSGlobalVariables.Parent
Set stpFTP = pkg.Steps("DTSStep_DTSFTPTask_1")
Set stpLog = pkg.Steps("DTSStep_DTSExecuteSQLTask_1")
'Execute FTP Step
stpFTP.Execute
'Error
If Err.Number <> 0 Then
'Message to event log
DTSGlobalVariables("gbvSysAppEventText").Value = Err.Description
stpLog.Execute
Err.Clear 'Clear the error.
Main = DTSTaskExecResult_Failure
Else
'Message to event log
DTSGlobalVariables("gbvSysAppEventText").Value = "File Transferred"
stpLog.Execute
Main = DTSTaskExecResult_Success
End If 'Error
End Function |