472,093 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,093 software developers and data experts.

Input string was not in the correct format

Hiya Folks,

I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005.
The main page consists of an aspx page and a master page.
The page also consists of a label control(hidden when run in browser).
Also an Sql data source control connected to database tables for a photo album.
Also label web control ID=UserIdValue.
Also a Details View control ID=dvPictureInsert
Problem is how to work out what an “Unhandled exception “is and how to work out what
“Input string was not in a correct format” is.
When I put a category, Id and description values on my website and click on the insert hyperlink you get the “Input string was not in the correct format”.
Input string was not in a correct format. It would be appreciated if someone could explain how to read and understand the unhandled exception below.

Below is the unhandled exception
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:
Expand|Select|Wrap|Line Numbers
  1. [FormatException: Input string was not in a correct format.]
  2. System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2752899
  3. System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
  4. System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
  5. System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
  6. System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +248
  7. System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +547
  8. System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +304
  9. System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +68
  10. System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean causesValidation) +394
  11. System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +609
  12. System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +88
  13. System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
  14. System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109
  15. System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
  16. System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +85
  17. System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
  18. System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
  19. System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
  20. System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170
  21. System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921
  24. Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
  27. Below is the event handler source code
  29. Partial Class PhotoAdmin_Default
  30. Inherits System.Web.UI.Page
  32. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  33. UserIdValue.Text = Membership.GetUser().ProviderUserKey.ToString()
  36. End Sub
  38. Protected Sub dvPictureInsert_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles dvPictureInsert.ItemInserting
  39. e.Values("UserId") = Membership.GetUser().ProviderUserKey
  40. e.Values("UploadedOn") = DateTime.Now
  42. End Sub
  43. End Class
Mar 21 '07 #1
0 3081

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by lianfe_ravago | last post: by
5 posts views Thread by blackg | last post: by
1 post views Thread by amitbadgi | last post: by
1 post views Thread by amitbadgi | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.