SSIS Script Task to Check if File Exists (to set Precedence Constraint)

  • I only want to proceed if there is a file in the inbox folder.  So I have a script task at the beginning of the package.  The src_inbox_folder var is read only, and the bool is_new_file var is read/write.

           public void Main()
            {
        MessageBox.Show(Dts.Variables["User::src_inbox_folder"].Value.ToString());  //this works fine
        Dts.Variables("User::is_new_file").Value = File.Exists(Dts.Variables("User::src_inbox_folder").Value); //this tells me that non-invocable member... cannot be used like a method

                Dts.TaskResult = (int)ScriptResults.Success;
            }

    What am I doing wrong?  Thanks!

    [font="Courier New"]ZenDada[/font]

  • LOL I'm an idiot.  Square brackets!

           public void Main()
            {
        MessageBox.Show(Dts.Variables["User::src_inbox_folder"].Value.ToString());
        Dts.Variables["User::is_new_file"].Value = System.IO.File.Exists(Dts.Variables["User::src_inbox_folder"].Value.ToString());

                Dts.TaskResult = (int)ScriptResults.Success;
            }

    [font="Courier New"]ZenDada[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply