2

I am using VS 2008

so I have two variables count_a and count_b declared as Int32 variables in the package scope I have added the two variables in the ReadOnlyVariables list of the Script Task Editor

my code inside the script task looks like this:

        if (Dts.Variables["count_a"].Value == Dts.Variables["count_b"].Value)
        {
             //do something
        }
        else
        {
             //do something
        }

the default value for both variables is zero. when I step through the code I see that both variables have a zero value but when evaluating this expression: Dts.Variables["count_a"].Value == Dts.Variables["count_b"].Value

I get a false

any one seen anything like this before

appreciate any suggestions

1 Answer 1

2

You aren't comparing 0 to 0. You are comparing the memory address of count_a to count_b. You'll need to access the .Value property of the object to get the value. Note that you would need to cast the Value into a primitive type. For the comparison you're performing, .Value.ToString() would suffice

Sign up to request clarification or add additional context in comments.

1 Comment

ahhh that makes sense just realized the type is object for .value ... thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.