Value was either too large or too small for an Int32.

Value was either too large or too small for an Int32.

Got this error today, no idea what it is. Have loads of records, all very similar, but when opening the edit page for this record it throws up an error...Any ideas, help would be greatly appreciated!


Value was either too large or too small for an Int32.
at System.Decimal.ToInt32(Decimal d)
at ssPhoebe.Flows.FlowMainFlow.ScrnWorkOrder_Edit.Preparation(HeContext heContext)
at ssPhoebe.Flows.FlowMainFlow.ScrnWorkOrder_Edit.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
eSpaceVer: 21 (Id=41, PubId=46, CompiledWith=
RequestUrl: http://csephoebeprod1/Phoebe/WorkOrder_Edit.aspx?WorkOrderId=8361 (Method: GET)
AppDomain: /LM/W3SVC/1/ROOT/Phoebe-2-129775765639747874
FilePath: C:\...\PS\running\Phoebe.01243687298\WorkOrder_Edit.aspx
Locale: en-US
DateFormat: dd/MM/yyyy
PID: 2236 ('w3wp', Started='30/03/2012 10:22:08', Priv=242Mb, Virt=1079Mb)
TID: 6
Thread Name: 
.NET: 2.0.50727.5448
Ok worked it out, I had a value that was over 2,147,483,647 being stored. Is there another data type I can use to store this (i currently have it as Decimal)?


Hi Tom,

You can keep it as Decimal, but need to be carefull with conversions.
What operations are you doing on your WorkOrder_Edit Preparation with that variable?
With that stacktrace it looks like it's explicitly converting to Integer at some point.

João Rosado

Hi Joao,

It is being coverted, you are right. It gets converted to text so the InputMask widget created by Antonio (I think) can format it with thousand seperators.

However, just noticed that instead of using DecimatToText() I am using IntegerToText() which is almost certainly the issue!

Think you may have cracked the issue!