Determine type of Value

Discussion in 'ASP General' started by Shahid Juma, Sep 29, 2004.

  1. Shahid Juma

    Shahid Juma Guest

    Hello All,

    This may be a trivial question, but I was wondering how can you determine if
    a value contains an Integer or Float. I know there is a function called
    IsNumeric, however you can't determine what type it is.

    Thanks for the help,
    Shahid
    Shahid Juma, Sep 29, 2004
    #1
    1. Advertising

  2. Shahid Juma wrote:
    > Hello All,
    >
    > This may be a trivial question, but I was wondering how can you
    > determine if a value contains an Integer or Float. I know there is a
    > function called IsNumeric, however you can't determine what type it
    > is.
    >
    > Thanks for the help,
    > Shahid


    If Int(val) = val then
    'It's an integer
    Else
    'It's a float
    End if

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 29, 2004
    #2
    1. Advertising

  3. Shahid Juma

    Shahid Juma Guest

    Thanks,

    A follow up to this question. How can you determine what type of variable it
    is from the record set. If you have a query that looks at a table in SQL
    Server. How can you tell that a certain field is varchar, bigint, int, etc?
    The reason for asking is that I need to know what type of variable it is and
    sometimes these fields are empty so using the value to determine what type
    won't work every time.

    Thanks,
    Shahid

    "Bob Barrows [MVP]" <> wrote in message
    news:%...
    > Shahid Juma wrote:
    > > Hello All,
    > >
    > > This may be a trivial question, but I was wondering how can you
    > > determine if a value contains an Integer or Float. I know there is a
    > > function called IsNumeric, however you can't determine what type it
    > > is.
    > >
    > > Thanks for the help,
    > > Shahid

    >
    > If Int(val) = val then
    > 'It's an integer
    > Else
    > 'It's a float
    > End if
    >
    > Bob Barrows
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    Shahid Juma, Sep 29, 2004
    #3
  4. Shahid Juma

    Mark Schupp Guest

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdprotype.asp

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Shahid Juma" <> wrote in message
    news:...
    > Thanks,
    >
    > A follow up to this question. How can you determine what type of variable

    it
    > is from the record set. If you have a query that looks at a table in SQL
    > Server. How can you tell that a certain field is varchar, bigint, int,

    etc?
    > The reason for asking is that I need to know what type of variable it is

    and
    > sometimes these fields are empty so using the value to determine what type
    > won't work every time.
    >
    > Thanks,
    > Shahid
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:%...
    > > Shahid Juma wrote:
    > > > Hello All,
    > > >
    > > > This may be a trivial question, but I was wondering how can you
    > > > determine if a value contains an Integer or Float. I know there is a
    > > > function called IsNumeric, however you can't determine what type it
    > > > is.
    > > >
    > > > Thanks for the help,
    > > > Shahid

    > >
    > > If Int(val) = val then
    > > 'It's an integer
    > > Else
    > > 'It's a float
    > > End if
    > >
    > > Bob Barrows
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >

    >
    >
    Mark Schupp, Sep 29, 2004
    #4
    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. Gernot Frisch

    how to determine type-type?

    Gernot Frisch, Jan 12, 2005, in forum: C++
    Replies:
    3
    Views:
    391
    Ulrich Achleitner
    Jan 13, 2005
  2. Replies:
    3
    Views:
    263
    Roedy Green
    Sep 15, 2007
  3. Jack Bates
    Replies:
    0
    Views:
    263
    Jack Bates
    May 2, 2011
  4. Peña, Botp
    Replies:
    1
    Views:
    221
    Robert Klemme
    Jan 24, 2004
  5. Replies:
    1
    Views:
    302
    Ryan Davis
    May 6, 2005
Loading...

Share This Page