IsNumeric returns false inexplicably

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Glenn Venzke

    IsNumeric returns false inexplicably

    For some reason all of a sudden number values pulled from a SQL server field
    with a datatype of "numeric" are not being recognized by asp classic as valid
    number values. They were previously, but now are not. When I use the
    "IsNumeric" function, it returns false. When I try to Ctype it to an integer,
    I get an "overflow" error. If I change the datatype of the database field to
    "int", it works fine. Whats the deal? The values I'm working with currently
    range from 33800 to 33850.
  • Aaron [SQL Server MVP]

    #2
    Re: IsNumeric returns false inexplicably

    CInt in VBScript only goes to 32k. So, use CLng instead.

    IsNumeric isn't exactly the most accurate test, either, but in order to see
    what is going on, please provide a repro.

    --
    Please contact this domain's administrator as their DNS Made Easy services have expired.

    (Reverse address to reply.)




    "Glenn Venzke" <GlennVenzke@di scussions.micro soft.com> wrote in message
    news:1AA7C70D-2D8D-4AA6-BA13-D90B32110A26@mi crosoft.com...[color=blue]
    > For some reason all of a sudden number values pulled from a SQL server[/color]
    field[color=blue]
    > with a datatype of "numeric" are not being recognized by asp classic as[/color]
    valid[color=blue]
    > number values. They were previously, but now are not. When I use the
    > "IsNumeric" function, it returns false. When I try to Ctype it to an[/color]
    integer,[color=blue]
    > I get an "overflow" error. If I change the datatype of the database field[/color]
    to[color=blue]
    > "int", it works fine. Whats the deal? The values I'm working with[/color]
    currently[color=blue]
    > range from 33800 to 33850.[/color]


    Comment

    • Bob Barrows [MVP]

      #3
      Re: IsNumeric returns false inexplicably

      Glenn Venzke wrote:[color=blue]
      > For some reason all of a sudden number values pulled from a SQL
      > server field with a datatype of "numeric"[/color]

      "numeric" is not a sufficient description of the column's datatype. Please
      tell us the precision and scale of the column.
      [color=blue]
      > are not being recognized by
      > asp classic as valid number values. They were previously, but now are
      > not.[/color]

      So what changed? And please provide some context. Are you talking about
      recordset fields? If so, what does the Type property of the field contain?
      Or are you talking about stored procedure output parameters?
      [color=blue]
      > When I use the "IsNumeric" function, it returns false. When I
      > try to Ctype it to an integer, I get an "overflow" error.[/color]

      I don't know of a Ctype function. Please be specific.
      [color=blue]
      > If I change
      > the datatype of the database field to "int", it works fine. Whats the
      > deal? The values I'm working with currently range from 33800 to 33850.[/color]

      That's why I asked you to be specific. CInt would generate an overflow error
      with these values. CLng would not.

      Bob Barrows
      --
      Microsoft MVP - ASP/ASP.NET
      Please reply to the newsgroup. This email account is my spam trap so I
      don't check it very often. If you must reply off-line, then remove the
      "NO SPAM"


      Comment

      Working...