我对这段代码感到沮丧,因为我无法弄清楚发生了什么。
在尝试编辑webform上的简单值时,我的用户偶尔会收到错误(我无法复制它,因为它对我来说很好):
Server Error in '/cp' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.
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:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +13908045
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +305
DevExpress.Web.ASPxPopupControl.Internal.PopupWindowClientStateUtils.LoadClientState(PopupWindow window, String state) +288
DevExpress.Web.ASPxPopupControl.ASPxPopupControl.LoadWindowsState(String state) +133
DevExpress.Web.ASPxClasses.ASPxWebControl.LoadPostDataInternal(NameValueCollection postCollection, Boolean raisePostDataEvent) +447
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +1068
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2773
它告诉我发生了异常,但不是在哪里或为什么。
用于保存存款更改的PopUp框按钮是:
Protected Sub btnDepPaid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDepPaid.Click
Try
ASPxPopupControl3.ShowOnPageLoad = False
Dim da As New bsTableAdapters.DepositTableAdapter
da.UpdateQuery(DepPaid.Text, CustID.Text)
Catch ex As Exception
End Try
End Sub
我有Elmah正在运行,所有显示的都是上面的错误 - 但是我看不出错误是怎么发生的 - 因为根据Elmah,DepPaid.Text和CustID.Text具有有效的“字符串”,例如:其中“65.00”。
我的沮丧是,错误并不是说问题在哪一行,只是“输入字符串格式不正确” - 我怎么能让它给我更多信息?
还有什么我可以添加到上面的代码,捕获错误发生的位置,或任何其他可以确定错误实际是什么的信息?
根据Elmah的说法,输入内容是:
谢谢,Mark