2016-11-16 572 views
-1

自2005年以来,我的一个应用程序正在运行。现在,它给出了下面提到的错误。多年后,Int16的值对于Int16来说太大或太小

我不知道发生了什么事。有没有人遇到过这样的问题?

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 
+0

我根本无法从堆栈跟踪中得知任何东西(即,提供堆栈跟踪引用的代码会有帮助)我会指出最大大小为Int16是“32767”(正值或负值)。根据堆栈跟踪,您的应用程序试图将大于或小于此值的内容放入Int16变量中。 – Shadow

+1

也许你在你的应用程序中使用的数据类型为Int16的字段已经超过了值32767. – Hakunamatata

+0

请发布'Attach_DL.Generatekey()'的源代码' –

回答

1

怀疑结果包含较大的值,其中Int16不能成立。整数的所有类型具有不同范围的下列存储容量

Int 16 -- (-32768 to +32787) 
+0

我保存了多年的记录。没有我给予巨大数字的领域。为什么其他数据像以前一样存储 –

+1

@MuhammadFahad主键? –

+0

no Bro。其实我的问题是,为什么它会在我们以前保存的相同数据集多年后出错。 –

0

你的字段可能自2005年以来被增加给现在值超过32787.

基于DB类型的数值EF产生的场(5)可能给int16,尽管它可以保持99999

相关问题