I am trying to add Mobile Number
to my column which is of 10 digit
But it is giving me error as
Value was either too large or too small for an Int32
Here is the code
drpartyInfo[0]["MOB_NUM"] = string.IsNullOrWhiteSpace(e.Record["MOB_NUM"].ToString())
? DBNull.Value : (object)Convert.ToInt32(e.Record["MOB_NUM"].ToString());
Better you should use long
, string
or byte array
.
You can refer this.
short.MaxValue: 32767
short.MinValue: -32768
ushort.MaxValue: 65535
ushort.MinValue: 0
int.MaxValue: 2,147,483,647
int.MinValue: -2,147,483,648
uint.MaxValue: 4,294,967,295
uint.MinValue: 0
long.MaxValue: 9,223,372,036,854,775,807
long.MinValue: -9,223,372,036,854,775,808
ulong.MaxValue: 18,446,744,073,709,551,615
You can use unsigned
datatype, if you are sure that it will always be positive number.
Mobile number can not be stored on int, change your type to string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With