input string was not in a correct format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sehguh
    New Member
    • Mar 2007
    • 4

    input string was not in a correct format

    Hello folks

    I have recently been studying a book called "sams teach yourself asp.net 2.0 in24 hours by scott mitchell. I have reached page 614 but when i tried to run an asp page called Photoadmin/default.aspx i got the following message and info.


    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.FormatEx ception: 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.S tringToNumber(S tring str, NumberStyles options, NumberBuffer& number, NumberFormatInf o info, Boolean parseDecimal) +2752899
    System.Number.P arseInt32(Strin g s, NumberStyles style, NumberFormatInf o info) +102
    System.String.S ystem.IConverti ble.ToInt32(IFo rmatProvider provider) +43
    System.Convert. ChangeType(Obje ct value, TypeCode typeCode, IFormatProvider provider) +293
    System.Web.UI.W ebControls.Para meter.GetValue( Object value, String defaultValue, TypeCode type, Boolean convertEmptyStr ingToNull, Boolean ignoreNullableT ypeChanges) +248
    System.Web.UI.W ebControls.SqlD ataSourceView.A ddParameters(Db Command command, ParameterCollec tion reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParame terFormatString ) +547
    System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteInsert(ID ictionary values) +304
    System.Web.UI.D ataSourceView.I nsert(IDictiona ry values, DataSourceViewO perationCallbac k callback) +68
    System.Web.UI.W ebControls.Deta ilsView.HandleI nsert(String commandArg, Boolean causesValidatio n) +394
    System.Web.UI.W ebControls.Deta ilsView.HandleE vent(EventArgs e, Boolean causesValidatio n, String validationGroup ) +609
    System.Web.UI.W ebControls.Deta ilsView.OnBubbl eEvent(Object source, EventArgs e) +88
    System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
    System.Web.UI.W ebControls.Deta ilsViewRow.OnBu bbleEvent(Objec t source, EventArgs e) +109
    System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
    System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +85
    System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng eventArgument) +153
    System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +7
    System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +170
    System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +4921

    I have also included the event handlers for the above problem:


    Version Information: Microsoft .NET Framework Version:2.0.507 27.42; ASP.NET Version:2.0.507 27.42

    Partial Class PhotoAdmin_Defa ult
    Inherits System.Web.UI.P age

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load
    UserIdValue.Tex t = Membership.GetU ser().ProviderU serKey.ToString ()


    End Sub

    Protected Sub dvPictureInsert _ItemInserting( ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Deta ilsViewInsertEv entArgs) Handles dvPictureInsert .ItemInserting
    e.Values("UserI d") = Membership.GetU ser().ProviderU serKey
    e.Values("Uploa dedOn") = DateTime.Now

    End Sub

    End Class

    thanx for your help
    john
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by sehguh
    Hello folks

    I have recently been studying a book called "sams teach yourself asp.net 2.0 in24 hours by scott mitchell. I have reached page 614 but when i tried to run an asp page called Photoadmin/default.aspx i got the following message and info.


    Input string was not in a correct format.
    What enctype was specified in your form?

    Jared

    Comment

    Working...