En un Script Task
, estoy tratando de recuperar un archivo desde una ubicación de red y FTP
ese archivo a una ubicación externaSSIS error de tarea de escritura de la recuperación de valores de variables
- En SSIS creé el
FTP Connection
y probado que es configuración y obras creado tres variables de
- variables 1. FullPathName = \ ftpservercsc \\\ filename.txt
- variable de 2 FTPFilePath = \ ftpservercsc \\\
- variable de 3 FTPFileName = filename.txt
Creado un
Script Task
y añadido el código VB como tal ...'Get instance of the connection manager. Dim cm As ConnectionManager = Dts.Connections("FTP Connection Manager") Dim remotePath As String = Dts.Variables("FTPFilePath").Value.ToString 'create the FTP object that sends the files and pass it the connection 'created above. Dim ftp As FtpClientConnection = New FtpClientConnection (cm.AcquireConnection(Nothing)) 'Connect to the ftp server ftp.Connect() 'Set the path on the FTP server where dropping files 'ftp.SetWorkingDirectory("/Prequalify") 'set the remote directory Dim files(0) As String files(0) = Dts.Variables("FTPFileName").Value.ToString 'eg. File1.trg 'Send File ftp.SendFiles(files, remotePath, True, True) ' Close the ftp connection ftp.Close() 'Dts.Events.FireInformation(0, context, "File " + fileToGet ' + " retrieved successfully.", Nothing, Nothing, True) Dts.TaskResult = Dts.Results.Success
de error: El elemento no se puede encontrar en una colección. Este error ocurre cuando intenta recuperar un elemento de una colección en un contenedor durante la ejecución del paquete y el elemento no está allí.
Así que he comentado y ha encontrado el error está generando en recuperar el valor de la variable, pero no sé lo que es incorrecto aquí
Dim remotePath As String = Dts.Variables("FTPFilePath").Value.ToString
que han intentado múltiples recuperaciones variables y todos obtener el mismo error. ¿Alguien ve algo mal?
Excelente! Eso fue exactamente eso. La secuencia de comandos se ejecuta ahora, pero no copia el archivo. Creo que esto me dio un gran comienzo. Gracias por la asistencia. –
Resolvió mi problema también - uv - gracias! –