ASP.Net Web Services: Error: System.ArgumentException: Cannot convert to System.Int32.

April 27, 2005

Whilst building a web service earlier today, I couldnt work out why I was getting an error when I added a integer parameter. (String paramters worked fine)

i.e. This worked:
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As String) As DataSet


This Didn’t:
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As Integer) As DataSet


Turns out to be a simple data type problem – b did not have a value, therefore it was null – Therefore not an integer.

Took me a good few hours to spot it though 😦

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: