Can't set Dts.Variables["User::boolEmployeeDetails2"].Value = True;

  • I have tried several different ways to set

    Dts.Variables["User::boolEmployeeDetails2"].Value = "True";

    I've used 1 and tried to use True (without quotes).

    What I get is: "The name True does not exist in the current context". I looked online and it appears that all I should have to do is set the variable to true. It is a Read/Write variable of Boolean type.

    public void Main()

    {

    // TODO: Add your code here

    string[] EmployeeDetails1files = Directory.GetFiles(@"C:\Users\Documents\Visual Studio 2010\Projects\BI Project\BI Project Files", "Employee_Details1*.txt");

    string[] EmployeeDetails2files = Directory.GetFiles(@"C:\Users\Documents\Visual Studio 2010\Projects\BI Project\BI Project Files", "Employee_Details2*.txt");

    string[] EmployeeDetails3files = Directory.GetFiles(@"C:\Users\Documents\Visual Studio 2010\Projects\BI Project\BI Project Files", "Employee_Details3*.txt");

    string[] Countryfiles = Directory.GetFiles(@"C:\Users\Documents\Visual Studio 2010\Projects\BI Project\BI Project Files", "*Country*.txt");

    string[] Statefiles = Directory.GetFiles(@"C:\Users\Documents\Visual Studio 2010\Projects\BI Project\BI Project Files", "*State*.txt");

    if (EmployeeDetails1files.Length > 0)

    {

    Dts.Variables["User::boolEmployeeDetails1"].Value = "True";

    }

    if (EmployeeDetails2files.Length > 0)

    {

    Dts.Variables["User::boolEmployeeDetails2"].Value = "True";

    }

    if (EmployeeDetails3files.Length > 0)

    {

    Dts.Variables["User::boolEmployeeDetails3"].Value = "True";

    }

    if (Countryfiles.Length > 0)

    {

    Dts.Variables["User::boolCountries"].Value = "True";

    }

    if (Statefiles.Length > 0)

    {

    Dts.Variables["User::boolStates"].Value = "True";

    }

    Dts.TaskResult = (int)ScriptResults.Success;

    }

  • The answer to the question is that true needs to be lowercase.

    In VB.NET True has an uppercase T. But in C# it is all lowercase.

  • Or try storing 0 (False) or 1 (True) instead.

    ____________________________________________________________

    AP

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

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