Differences
This shows you the differences between the selected revisions of the page.
2012-06-04 | 2012-06-05 | ||
example anchor (martin) | using Dts.Variables and Dts.Events (martin) | ||
Line 37: | Line 37: | ||
{ | { | ||
Protocol = Protocol.Sftp, | Protocol = Protocol.Sftp, | ||
- | HostName = "example.com", | + | // To setup these variables, go to SSIS > Variables. |
- | UserName = "user", | + | ················// To make them accessible from the script task, in the context menu of the task, |
- | Password = "mypassword", | + | // choose Edit. On the Script task editor on Script page, select ReadOnlyVariables, |
- | SshHostKey = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | // and tick the below properties. |
+ | HostName = (string) Dts.Variables["User::HostName"].Value, | ||
+ | UserName = (string) Dts.Variables["User::UserName"].Value, | ||
+ | Password = (string) Dts.Variables["User::Password"].Value, | ||
+ | ················SshHostKey = (string) Dts.Variables["User::SshHostKey"].Value | ||
}; | }; | ||
Line 67: | Line 71: | ||
foreach (TransferEventArgs transfer in transferResult.Transfers) | foreach (TransferEventArgs transfer in transferResult.Transfers) | ||
{ | { | ||
- | Dts.Log(string.Format("Upload of {0} succeeded", transfer.FileName), 0, null); | + | Dts.Events.FireInformation(0, null, |
+ | ····························string.Format("Upload of {0} succeeded", transfer.FileName), | ||
+ | null, 0, ref fireAgain); | ||
} | } | ||
} | } | ||
Line 75: | Line 81: | ||
catch (Exception e) | catch (Exception e) | ||
{ | { | ||
- | Dts.Log(string.Format("Error when using WinSCP to upload files: {0}", e), 0, null); | + | Dts.Events.FireError(0, null, |
+ | ····················string.Format("Error when using WinSCP to upload files: {0}", e), | ||
+ | null, 0); | ||
Dts.TaskResult = (int)DTSExecResult.Failure; | Dts.TaskResult = (int)DTSExecResult.Failure; |