Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Determine type of Value (http://www.velocityreviews.com/forums/t796540-determine-type-of-value.html)

 Shahid Juma 09-29-2004 02:17 PM

Determine type of Value

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

 Bob Barrows [MVP] 09-29-2004 02:24 PM

Re: Determine type of Value

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 09-29-2004 02:51 PM

Re: Determine type of Value

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]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23KCuKAjpEHA.3668@TK2MSFTNGP15.phx.gbl...
> 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 09-29-2004 03:11 PM

Re: Determine type of Value

http://msdn.microsoft.com/library/de.../mdprotype.asp

--
Mark Schupp
Integrity eLearning
www.ielearning.com

"Shahid Juma" <shahid319REMOVETHIS@hotmail.com> wrote in message
news:unUgtMjpEHA.4004@TK2MSFTNGP10.phx.gbl...
> 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]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%23KCuKAjpEHA.3668@TK2MSFTNGP15.phx.gbl...
> > 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.
> >
> >

>
>

 All times are GMT. The time now is 01:47 AM.