Differentiate between a number and text???

Results 1 to 2 of 2

Thread: Differentiate between a number and text???

  1. #1
    Join Date
    Dec 1969

    Default Differentiate between a number and text???

    I&#039;m pulling stuff from a text field in a database. Sometimes there are numbers stored in this field, sometimes there is text... <BR><BR>No matter what I pull out... 23, hello, 4283, if i do a IsNumeric on the value, it will always come up false... How can I <BR>differentiate between the two?<BR><BR>thanks for any help.<BR>dep<BR>

  2. #2
    Join Date
    Dec 1969

    Default IsNumeric *should* work...

    ...but maybe that field is a CHAR field (instead of VARCHAR) and is padded with spaces? Or maybe it has line break characters in it?<BR><BR>You can *try* doing<BR> If IsNumeric( TRIM( RS("whatever") ) ) Then<BR>and if it is only spaces that are getting in the way that will work.<BR><BR>But if it&#039;s other characters, then you might need to do a little debugging to find out what is actually there:<BR><BR> temp = RS("whatever")<BR> For i = 1 To Len(temp)<BR> ch = Mid( temp, i, 1 )<BR> Response.Write i & ":" & ch & " [" & Asc(ch) & "]&#060;br/&#062;"<BR> Next<BR><BR>And show us what that output shows you.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts