Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Tasks Halts Package Execution

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
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
 
Tell us the properties on the precedence constraint between the FTP task and the next task. Also, what kind of task is the next task? Give us a few more details about that.

Lastly, open the solution up in BIDS and do a Start->Debug. When it stops at the FTP task, look at the bottom of your BIDS window for a "window" called OUTPUT. Post the output in this thread for us. It'll give more details on the error.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top