0

I can set almost all properties of FTP task and FTP connection manager using expressions option. In that option, I don't see that I can set FTP PASSWORD using a variable. How do I set the password dynamically ?

Thanks.

Steam
  • 9,368
  • 27
  • 83
  • 122

2 Answers2

1

Some approaches I looked at -

  1. Use a Script to set the value of password.
  2. Use a config file (no way !)
  3. Use a C# script instead of the Script task. (Nice !)

(1) Link - http://wannabesoftwareengineer.blogspot.com/2009/03/setting-ftp-password-from-external.html

VB code -

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

Public Sub Main()

Dim FTPConnectionManager As ConnectionManager


FTPConnectionManager = Dts.Connections("FTP_Conn")


FTPConnectionManager.Properties("ServerPassword").SetValue(FTPConnectionManager, 
Dts.Variables("FTPPassword").Value)

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

(2) Link - Uploading into folder in FTP?

Community
  • 1
  • 1
Steam
  • 9,368
  • 27
  • 83
  • 122
-1

You can definitely use a variable as the password, within the expressions tab add an expression for the password property, you can select any variable, or parameter.

Eli Ekstein
  • 466
  • 8
  • 19