• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: Nice error message

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Nice error message"

Collapse

  • suityou01
    replied
    Originally posted by DimPrawn View Post
    Use the Convert.ToInt32 method.

    Move all those comparisons and conversions into helper methods to cut down coding.

    I suspect your row does not contain 177.
    Definately does contain 177. Bizarre error message.

    By casting the row item to a string, and then using Int32.parse it works. I shall also try your suggestion.

    What's wrong with a good old "data type mismatch" error FFS.

    Leave a comment:


  • DimPrawn
    replied
    Use the Convert.ToInt32 method.

    Move all those comparisons and conversions into helper methods to cut down coding.

    I suspect your row does not contain 177.

    Also, what's with all this:

    if (!row["ISOC"].Equals((object)DBNull.Value))

    rather than

    if (row["ISOC"] != DBNull.Value)


    Are you paid per character typed?
    Last edited by DimPrawn; 24 July 2009, 10:20.

    Leave a comment:


  • suityou01
    started a topic Nice error message

    Nice error message

    Consider the following c# 2005 code

    if (!row["ISOC"].Equals((object)DBNull.Value))
    {
    retval[cnt].isoc = (Int32)row["ISOC"];
    }

    Now my object in the array has an isoc property, of type Int32.

    The value of row["ISOC"] is 177.

    The error I get is

    When casting from a number, the value must be a number less than infinity.

    Now the last time I checked, 177 was less than infinity.

    Googling but not really getting anywhere.
Working...
X