Error: System.ArgumentException: Cannot convert to System.Int32.

Discussion in 'ASP .Net' started by Simon Harris, Apr 27, 2005.

  1. Simon Harris

    Simon Harris Guest

    I have created a web service, which when I call in my browser presents the
    text form etc. When I click the button, I get this error:

    System.ArgumentException: Cannot convert to System.Int32.
    Parameter name: type ---> System.FormatException: Input string was not in
    a
    correct format.
    at System.Number.ParseInt32(String s, NumberStyles style,
    NumberFormatInfo info)
    at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
    at System.Convert.ChangeType(Object value, Type conversionType,
    IFormatProvider provider)
    at System.Web.Services.Protocols.ScalarFormatter.FromString(String
    value,
    Type type)
    --- End of inner exception stack trace ---
    at System.Web.Services.Protocols.ScalarFormatter.FromString(String
    value,
    Type type)
    at
    System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValu
    eCollection
    collection)
    at
    System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest
    request)
    at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
    at System.Web.Services.Protocols.WebServiceHandler.Invoke()
    at
    System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()This
    seems to happen only when I have parameters of different data types, e.g.:

    Works:
    ======
    <WebMethod()> _
    Public Function GetAddresses(ByVal a As String, ByVal b As String) As
    DataSet

    Causes Error:
    ===========
    <WebMethod()> _
    Public Function GetAddresses(ByVal a As String, ByVal b As Integer) As
    DataSet

    Any ideas/suggestions will be much appreciated.



    Regards,

    Simon.
    Simon Harris, Apr 27, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig Deelsnyder
    Replies:
    1
    Views:
    4,632
    =?Utf-8?B?U2hhd24gS2VubmV5?=
    Jul 19, 2004
  2. =?Utf-8?B?SGlmbmkgU2hhaHphcmQ=?=

    Invalid cast from System.Int32 to System.Byte[].

    =?Utf-8?B?SGlmbmkgU2hhaHphcmQ=?=, Feb 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,779
    William F. Robertson, Jr.
    Feb 15, 2005
  3. Simon Harris
    Replies:
    2
    Views:
    2,588
    Simon Harris
    Apr 27, 2005
  4. keithb
    Replies:
    3
    Views:
    18,503
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    May 7, 2006
  5. Replies:
    20
    Views:
    9,711
    licebmi
    Sep 7, 2009
Loading...

Share This Page