dbTalk Databases Forums  

Returning from a DTS FTPTask Error

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


Discuss Returning from a DTS FTPTask Error in the microsoft.public.sqlserver.dts forum.



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

Default 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



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.