I am trying to post the file to ftp site, file is posted as empty whenever i run the package. but when i run the task individually the file is posted in the ftp site, could you please tell what could be the error. i am using same code to post another file in the same location it works perfect....
i am using following code
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
Public Sub Main()
Try
'Create the connection to the ftp server
Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
'Set the properties like username & password
cm.Properties("ServerName").SetValue(cm, "XXXXX")
cm.Properties("ServerUserName").SetValue(cm, "XXX")
cm.Properties("ServerPassword").SetValue(cm, "XXXX")
cm.Properties("ServerPort").SetValue(cm, "21")
cm.Properties("Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeout
cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb
cm.Properties("Retries").SetValue(cm, "1")
'create the FTP object that sends the files and pass it the connection created above.
Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))
'Connects to the ftp server
ftp.Connect()
'Build a array of all the file names that is going to be FTP'ed (in this case only one file)
Dim files(2) As String
files(0) = "F:\NNExtract\Staging\PDI_NN_Program_" + Format(Now(), "yyyyMMdd") + ".xls"
'ftp the file
ftp.SendFiles(files, "/veeva/VeevaShipments/NewFolder", True, True)
ftp.Close()
Catch ex As Exception
Dts.TaskResult = Dts.Results.Failure
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
End Class