developer155
Programmer
I have a script task in my SSIS package that is responsible for FTP'ing a file. It processes normally, file gets FTP'ed, gets to Success but then package execution stops after the task without going to the next step!
The script task is green after execution (no errors). Why is this happening? Theconnection to the next step does not have any conditions or anything. I tried to make connection OnSuccess and OnCompletion but nothing works!
Here is the code in the Script Task fr FTP'ing a file
Dim host As String = Dts.Variables("ConnectionString").Value.ToString
Dim username As String = Dts.Variables("ServerUserName").Value.ToString
Dim password As String = Dts.Variables("ServerPassword").Value.ToString
Dim fileContents() As Byte
Dim URI As String = host & Dts.Variables("FTPTo").Value.ToString
'MsgBox("FTPTo: " & URI)
Dim request As System.Net.FtpWebRequest = _
CType(FtpWebRequest.Create(URI), FtpWebRequest)
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
request.Credentials = New _
System.Net.NetworkCredential(username, password)
Dim sourceStream As New StreamReader(Dts.Variables("FTPFrom").Value.ToString)
fileContents = System.Text.Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())
sourceStream.Close()
request.ContentLength = fileContents.Length
Dim requestStream As Stream
requestStream = request.GetRequestStream()
requestStream.Write(fileContents, 0, fileContents.Length)
requestStream.Close()
Dim ftpResponse As FtpWebResponse = CType(request.GetResponse, FtpWebResponse)
ftpResponse.Close()
' MsgBox(" I made it")
Dts.TaskResult = Dts.Results.Success
The script task is green after execution (no errors). Why is this happening? Theconnection to the next step does not have any conditions or anything. I tried to make connection OnSuccess and OnCompletion but nothing works!
Here is the code in the Script Task fr FTP'ing a file
Dim host As String = Dts.Variables("ConnectionString").Value.ToString
Dim username As String = Dts.Variables("ServerUserName").Value.ToString
Dim password As String = Dts.Variables("ServerPassword").Value.ToString
Dim fileContents() As Byte
Dim URI As String = host & Dts.Variables("FTPTo").Value.ToString
'MsgBox("FTPTo: " & URI)
Dim request As System.Net.FtpWebRequest = _
CType(FtpWebRequest.Create(URI), FtpWebRequest)
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
request.Credentials = New _
System.Net.NetworkCredential(username, password)
Dim sourceStream As New StreamReader(Dts.Variables("FTPFrom").Value.ToString)
fileContents = System.Text.Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())
sourceStream.Close()
request.ContentLength = fileContents.Length
Dim requestStream As Stream
requestStream = request.GetRequestStream()
requestStream.Write(fileContents, 0, fileContents.Length)
requestStream.Close()
Dim ftpResponse As FtpWebResponse = CType(request.GetResponse, FtpWebResponse)
ftpResponse.Close()
' MsgBox(" I made it")
Dts.TaskResult = Dts.Results.Success