我正在尝试将 Mobile Number
添加到我的 10 位数字的列中
但它给我的错误是
Value was either too large or too small for an Int32
这是代码
drpartyInfo[0]["MOB_NUM"] = string.IsNullOrWhiteSpace(e.Record["MOB_NUM"].ToString())
? DBNull.Value : (object)Convert.ToInt32(e.Record["MOB_NUM"].ToString());
最好使用long
、string
或byte array
。
你可以引用这个。
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
您可以使用unsigned
数据类型,如果您确定它总是正数的话。