c# - SSIS Script Vague Error "Object Refrence not set to an instance of an object" -
i'm working on ssis script, , going through visual studio, when execute get:
[ftp script task] error: error: object reference not set instance of object.
here's code running. doing wrong?
public void main() { try { // ftp connection connection managers collection connectionmanager ftpserver = dts.connections["sftp_connection"]; // create ftp connection object , credentials of connection manager ftpclientconnection sftp_connection = new ftpclientconnection(ftpserver.acquireconnection(null)); // open connection sftp_connection.connect(); // set work folder value of variable sftp_connection.setworkingdirectory(dts.variables["ftpworkingdirectory"].value.tostring()); // create stringarrays filenames , folders // foldernames aren't used, mandatory // next method. string[] filenames; string[] foldernames; // directory listing , fill 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 success dts.taskresult = (int)scriptresults.success; } catch (exception ex) { // fire error , set result failure dts.events.fireerror(0, "ftp script task", "error: " + ex.message, string.empty, 0); dts.taskresult = (int)scriptresults.failure; } }