changing txt to number

changing txt to number

am 21.04.2005 03:23:11 von jeff

I am using access DB.
i have a large table that i have aquired, and all the data in the fields are
actually txt. unfortunatly, the data is integers stored as txt. the future
plan, is to redo the DB, and make the fields numeric, but for now, i need a
way to retrieve data, and change it to numeric.

so if field cc_callNumbers is a 7.. but the field type is txt, in my asp
page i can call that as say

var1 = sales_data.fields.item("cc_callNumbers").value

that value returns a txt 7, but i need to convert it to a number 7, so i can
do math with the data. is this possible?
thanks
jeff

Re: changing txt to number

am 21.04.2005 05:46:31 von unknown

What language are your ASP pages in? VBScript? See CInt, CLng, CSng, CDbl,
and other such conversion functions.

http://msdn.microsoft.com/library/en-us/script56/html/vsfctC Int.asp

WSH Documentation:
http://www.microsoft.com/downloads/details.aspx?FamilyId=015 92C48-207D-4BE1-8A76-1C4099D7BBB9

Ray at home


"Jeff" wrote in message
news:JuKdnRA3MujknfrfRVn-qw@adelphia.com...
>I am using access DB.
> i have a large table that i have aquired, and all the data in the fields
> are actually txt. unfortunatly, the data is integers stored as txt. the
> future plan, is to redo the DB, and make the fields numeric, but for now,
> i need a way to retrieve data, and change it to numeric.
>
> so if field cc_callNumbers is a 7.. but the field type is txt, in my asp
> page i can call that as say
>
> var1 = sales_data.fields.item("cc_callNumbers").value
>
> that value returns a txt 7, but i need to convert it to a number 7, so i
> can do math with the data. is this possible?
> thanks
> jeff
>

Re: changing txt to number

am 22.04.2005 21:09:33 von Roland Hall

"Jeff" wrote in message news:JuKdnRA3MujknfrfRVn-qw@adelphia.com...
:I am using access DB.
: i have a large table that i have aquired, and all the data in the fields
are
: actually txt. unfortunatly, the data is integers stored as txt. the future
: plan, is to redo the DB, and make the fields numeric, but for now, i need
a
: way to retrieve data, and change it to numeric.
:
: so if field cc_callNumbers is a 7.. but the field type is txt, in my asp
: page i can call that as say
:
: var1 = sales_data.fields.item("cc_callNumbers").value
:
: that value returns a txt 7, but i need to convert it to a number 7, so i
can
: do math with the data. is this possible?

As Ray said....

var1 = CInt(sales_data.fields.item("cc_callNumbers").value)

To verify:

Response.Write typename(var1)

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: changing txt to number

am 23.04.2005 14:19:08 von jeff

Yes.. that worked wonderfully. At some point i will go back in and revamp
the DB, but i aquired it too large and too much info..lol
But hey, I have vacation coming up.


"Jeff" wrote in message
news:JuKdnRA3MujknfrfRVn-qw@adelphia.com...
>I am using access DB.
> i have a large table that i have aquired, and all the data in the fields
> are actually txt. unfortunatly, the data is integers stored as txt. the
> future plan, is to redo the DB, and make the fields numeric, but for now,
> i need a way to retrieve data, and change it to numeric.
>
> so if field cc_callNumbers is a 7.. but the field type is txt, in my asp
> page i can call that as say
>
> var1 = sales_data.fields.item("cc_callNumbers").value
>
> that value returns a txt 7, but i need to convert it to a number 7, so i
> can do math with the data. is this possible?
> thanks
> jeff
>

Re: changing txt to number

am 10.05.2005 10:37:57 von Renugopal

Hi,
use CInt(value)
this will convert the string type of number into Integer
thanks
-Renugopal

"Jeff" wrote in message
news:JuKdnRA3MujknfrfRVn-qw@adelphia.com...
> I am using access DB.
> i have a large table that i have aquired, and all the data in the fields
are
> actually txt. unfortunatly, the data is integers stored as txt. the future
> plan, is to redo the DB, and make the fields numeric, but for now, i need
a
> way to retrieve data, and change it to numeric.
>
> so if field cc_callNumbers is a 7.. but the field type is txt, in my asp
> page i can call that as say
>
> var1 = sales_data.fields.item("cc_callNumbers").value
>
> that value returns a txt 7, but i need to convert it to a number 7, so i
can
> do math with the data. is this possible?
> thanks
> jeff
>
>