SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
ZenDada
ZenDada
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3365 Visits: 359
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!

ZenDada
ZenDada
ZenDada
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3365 Visits: 359
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;
}

ZenDada
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search