April 1, 2010 at 7:27 am
Hello,
Has anyone coded a script task that will upload 2 or more files to an FTP folder?
I have done the same using a ForLoop and an FTP task but I need the code in a Script task that will not use a foreach loop container
Rgds,
See
Rex Smith
April 1, 2010 at 9:57 am
Nope.
April 1, 2010 at 10:44 am
This link contains code for an Active X Script Task in DTS to do what you want. It shouldn't be too hard to put in a SSIS Script task.
http://www.sqlservercentral.com/Forums/Topic444266-19-1.aspx
April 6, 2010 at 8:26 am
Hello,
Both scripts are different. I need the VB.Net Script.
Rgds,
See
Rex Smith
April 8, 2010 at 9:59 am
seeteshh (4/1/2010)
Hello,Has anyone coded a script task that will upload 2 or more files to an FTP folder?
I have done the same using a ForLoop and an FTP task but I need the code in a Script task that will not use a foreach loop container
Rgds,
Seetesh
What's the point of this exercise?
April 8, 2010 at 10:08 am
seeteshh (4/6/2010)
Hello,Both scripts are different. I need the VB.Net Script.
Rgds,
Seetesh
Is there a reason you can't use a for-each loop.
doing this in .net is farily straight foward, start off by referencing System.Net and then use the FTP classes in there.
http://msdn.microsoft.com/en-us/library/system.net.aspx"> http://msdn.microsoft.com/en-us/library/system.net.aspx
April 9, 2010 at 10:01 am
Our client has instructed to write script task where ftp password & other information is kept in some other files.
Rex Smith
April 9, 2010 at 10:05 am
seeteshh (4/9/2010)
Our client has instructed to write script task where ftp password & other information is kept in some other files.
You can accomplish this without a need to write a script to FTP. You can write a script, which sets package variables and then use expressions to setup your FTP connection manager with the proper credentials information.
April 9, 2010 at 10:29 am
Dim ssisFtp As FtpClientConnection
Try
'Now we create an SSIS connection for pulling the files:
Dim ssisConn As ConnectionManager = Dts.Connections.Add("FTP")
'Set the properties like username & password
Dim intRetries As Int32 = Int32.Parse(Dts.Variables("FtpRetry").Value.ToString)
ssisConn.Properties("ServerName").SetValue(ssisConn, Dts.Variables("ServerName").Value.ToString)
ssisConn.Properties("ServerUserName").SetValue(ssisConn, Dts.Variables("FTPUser").Value.ToString)
ssisConn.Properties("ServerPassword").SetValue(ssisConn, Dts.Variables("FTPPassword").Value.ToString)
ssisConn.Properties("ServerPort").SetValue(ssisConn, Dts.Variables("ServerPort").Value.ToString)
'The 0 setting will make it not timeout
ssisConn.Properties("Timeout").SetValue(ssisConn, Dts.Variables("TimeOut").Value.ToString)
ssisConn.Properties("ChunkSize").SetValue(ssisConn, Dts.Variables("ChunkSize").Value.ToString) '1000 kb
ssisConn.Properties("Retries").SetValue(ssisConn, intRetries.ToString)
'Next we create the FTP Connection
ssisFtp = New FtpClientConnection(ssisConn.AcquireConnection(Nothing))
'And we pass the modified file names in to retrieve the inflated files:
ssisFtp.Connect()
//Need to modify this code ********************
Dim requiredFiles(2) As String
requiredFiles(0) = "a.doc"
requiredFiles(1) = "b.doc"
// End - Need to modify this code *****************
Dim intCount As Int32 = 0
While (requiredFiles.Length > 0 OrElse (requiredFiles.Length = 1 AndAlso requiredFiles(0) <> "")) AndAlso intCount <= intRetries
ssisFtp.SendFiles(requiredFiles, Dts.Variables("FtpDestination").Value.ToString, True, False)
intCount += 1
End While
Need to work on the code postfix with ******
Rex Smith
April 15, 2010 at 4:24 am
Any clues on this?
Rex Smith
April 28, 2010 at 12:35 pm
Has anyone used an array for files?
Rex Smith
May 20, 2010 at 4:38 am
Hi Cozy/all,
Can you post a sample snippet of script task reading data like userid/password/ipaddress from some flat file and using these as variables in the code.
Instead of declaring environment variables.
Rgds,
Seetesh
Rex Smith
May 20, 2010 at 4:55 am
use third party software like filezilla...
😛
May 20, 2010 at 6:28 am
RexSmith (5/20/2010)
Hi Cozy/all,Can you post a sample snippet of script task reading data like userid/password/ipaddress from some flat file and using these as variables in the code.
Instead of declaring environment variables.
Rgds,
Seetesh
You can use XML configuration file or SQL Table. There is no out-of-the-box setup from flat file.
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply