Note that there are some explanatory texts on larger screens.

plurals
  1. POSSIS Script Vague Error "Object Refrence not set to an instance of an object"
    text
    copied!<p>I'm working on a SSIS script, and everything is going well through Visual Studio, however when I execute I get:</p> <blockquote> <p>[FTP Script Task] Error: Error: Object reference not set to an instance of an object.</p> </blockquote> <p>Here's the code I am running. What am I doing wrong?</p> <pre><code> public void Main() { try { // Get the ftp connection from the Connection Managers collection ConnectionManager ftpServer = Dts.Connections["SFTP_Connection"]; // Create a FTP connection object and us the credentials of connection manager FtpClientConnection SFTP_Connection = new FtpClientConnection(ftpServer.AcquireConnection(null)); // Open the connection SFTP_Connection.Connect(); // Set work folder with the value of the variable SFTP_Connection.SetWorkingDirectory(Dts.Variables["FtpWorkingDirectory"].Value.ToString()); // Create StringArrays for filenames and folders // The folderNames aren't used, but is mandatory // for the next method. String[] fileNames; String[] folderNames; // Get a directory listing and fill the StringArray variables SFTP_Connection.GetListing(out folderNames, out fileNames); SFTP_Connection.ReceiveFiles(fileNames, "\\\\server\\e$\\INFORMATICA_INCOMING\\VERSADEX\\CAD\\work\\Test\\", false, false); // Close connection SFTP_Connection.Close(); // Close Script Task, set result to success Dts.TaskResult = (int)ScriptResults.Success; } catch (Exception ex) { // Fire error and set result to failure Dts.Events.FireError(0, "FTP Script Task", "Error: " + ex.Message, string.Empty, 0); Dts.TaskResult = (int)ScriptResults.Failure; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload