user1254579
user1254579

Reputation: 4009

SSIS:Dts Script task has encountered an exception in user code: Exception has been thrown by the target of an invocation

The package contain script task shows below error

Dts Script task has encountered an exception in user code:
Exception has been thrown by the target of an invocation

The script task code is

public void Main()
        {
            string Str_Filepath = Dts.Variables["User::FilePath"].Value.ToString();

            bool bl_exist=false;


            if (System.IO.File.Exists(Str_Filepath))
            {
                bl_exist = true;


             }
             else
            { bl_exist = false; }

            Dts.Variables["User::V_Exist"].Value = bl_exist;


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

Upvotes: 1

Views: 3336

Answers (1)

LONG
LONG

Reputation: 4610

That simply means the code has error.

did you set the V_Exist data type to boolean?

Upvotes: 1

Related Questions