Reputation: 13
I've taken a look at the MSDN but there is no information about a possible exception. However when I use the following code I receive an overflow exception as the value is too large for int32. But the return value according to MDSN is type object. Even when casting the return value to data type LONG it throws an exception.
Can someone please tell me what I am doing wrong?
new DataTable().Compute("2075144101+100000000", null);
Upvotes: 1
Views: 479
Reputation: 7703
The problem is that DataTable.Compute
is assuming that the input values are Int32
, so it is parsing to it resulting in an Overflow. You can change this behaviour adding a decimal, so it would be parsed like a Decimal
instead,like
this:
var a=new DataTable().Compute("2075144101.0+100000000.0", null);
Upvotes: 1