值对于多年后的Int16来说要么太大要么太小
本文关键字:于多年 Int16 | 更新日期: 2023-09-27 18:18:19
我的一个应用程序自2005年以来一直在运行。现在它给出了下面提到的错误。
我不知道发生了什么事。有人遇到过这样的问题吗?Server Error in '/' Application.
Value was either too large or too small for an Int16.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Value was either too large or too small for an Int16.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Value was either too large or too small for an Int16.]
Attach_DL.Generatekey() +121
Attach_BL.GenerateKey() +12
Picture.AddAttachments(String _attachpath, String _attachpathDB) +289
Picture.Btnsave_Click(Object sender, EventArgs e) +1416
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
怀疑结果包含Int16
不能容纳的较大值。所有类型的整数存储容量
Int 16 -- (-32768 to +32787)
您的字段可能从2005年开始增加,现在的值超过32787。
EF根据DB类型(numeric(5)可能给出的int16)生成字段,尽管它可以保存99999