Hi Peter:
I've tested it using the number you mention and I'm not having the
problem..works fine. However, if I use positive numbers it won't b/c the
range is -9,223,372,036,854,775,808 through positive
9,223,372,036,854,775,807, so if I use a ++ then I'll overrun the type,
but -807 is less than -808 so that's not a problem. I'm just wondering if
you're using literals or if you are using MinValue/MaxValue. I'd normally
use those just to be safe (it'd be easy to type one number wrong altough the
ones you have below are correct) but to replicate the problem I used the
hard coded values. First off,the assertions all pass but that's not really
the issue, that's just how I am illustrating that there's no typo in my
numbers.. since Min Value equals the hard coded number we know that's good.
Since MinValue + 1 (since it's negative) = the second number, we know
there's no typo there either. Anyway, not sure what it could be but I've
used the exact code and can't replicate it. Stupid question but that is the
exact code that's throwing the exception right? Try doing it with MinValue
and MinValue +1 and see if it persists. One more thing. I suspected that
the problem may be with a project setting for Checked vs. UnChecked code.
Perhaps if it was checked it would throw an exception if you had overflow
but if you had a typo and it was unchecked, it might let it slip through
(But we've verified that there's not a typo). But I ran the same code
changing the check for overflow and wrapped it in checked and unchecked in
the code and still didn't get an exception. That's really puzzling too b/c
if IsNull converts it to the Int64 default, and the number you used was
bigger than an Int64, i'd really expect it to bomb, wouldn't you? I mean
each time it sees null, it's inserting the value that you specify and that
value has to be an Int64. Now, here's the really interesting part, if I
switch the numbers for the first one for instance and use
IsNull(myInt64Column, 'Bill') = 'Bill', where it's expecting a Int64 instead
of a string, I get a DataEvaluation Error saying it can't compare Int64 to
String. That makes sense, but if why wouldn't it let you compare two Int64
values if they are both legit and it's even more weird that it works on one
machine and not another even though it's the same code. You are right, it's
weird indeed.
Int64 i = Int64.MinValue;
Debug.WriteLine(i.ToString());
Debug.WriteLine((i+1).ToString());
Debug.Assert(i == -9223372036854775808, "Min Value Ok");
dv.RowFilter = "IsNull(myInt64Column, -9223372036854775808)
= -9223372036854775808";
MessageBox.Show("-9223372036854775808", "First One Worked");
i++;
Debug.Assert(i == -9223372036854775807, "-1 Worked");
dv.RowFilter = "IsNull(myInt64Column, -9223372036854775807)
= -9223372036854775807";
MessageBox.Show("-9223372036854775807", "Second One Worked");