April 25, 2008 at 9:55 am
In the first step of my SSIS package I need to get files from FTP and dump it/them in a local directory, but it's more than that, the logic is like this:
1. If no file(s) found, stop executing and send email saying no file(s) found;
2. If file(s) found, then compare it/them with existing files in our archive folder; if file(s) already exist in archive folder, stop executing and send email saying file(s) already existed, if file(s) not in archive folder yet, then transfer it/them to the local directory for processing.
I had the following in script task but when I execute this task i got the error that "the task is configured to pre-compile the script, but binary code is not found." I chnaged the precomileScript to False then the error is The task cannot execute in 64-bit environment because the script is not pre-compiled. Even if I closed it out and opened it again it still didn't work (this method worked for me before when I had the same error), so I think the script itself may have some problem but I can't figure out where.
Thanks!!
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
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, "ftp.name.com")
cm.Properties("ServerUserName").SetValue(cm, "username")
cm.Properties("ServerPassword").SetValue(cm, "password")
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.SetWorkingDirectory("..")
http://ftp.SetWorkingDirectory("directory")
If File.Exists(Dts.Connections("FTP").AcquireConnection(Nothing).ToString()) Then
Dts.TaskResult = Dts.Results.Success
'later on i'm going to put logic here to compare the files with files in archive folder
MsgBox("FileExists")
Else
Dts.TaskResult = Dts.Results.Failure
MsgBox("FileNotExists")
End If
End Sub
End Class
April 25, 2008 at 10:21 am
I have only seen this error in a script component in a data flow task and it is because I did not click okay when exiting the component, I clicked Cancel or "X"'d out. I don't know if the Script Task does the same thing.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply