comma as decimal point?
am 12.01.2007 14:31:50 von kim
I need to be able to write numbers to an Access database using comma as
decimal point like 22,5 (using the comma-sign). This won't work, if I use
22,5 it gets rounded up to 23, id I use 22.5 (which i can't anyway for other
reasons) nothing gets stored at all. ?
Re: comma as decimal point?
am 12.01.2007 16:18:38 von exjxw.hannivoort
Kim wrote on 12 jan 2007 in microsoft.public.inetserver.asp.db:
> I need to be able to write numbers to an Access database using comma
> as decimal point like 22,5 (using the comma-sign).
You mean using ASP and the Jet engine?
The above should be named a string, numbers have no points or commas.
usng ASP-vbs:
s1 = "22.5"
s2 = replace(s1,".",",")
usng ASP-jscript:
s1 = '22.5';
s2 = s1.replace(/\./,',');
> This won't work, if I use 22,5 it gets rounded up to 23
So why do you need it then?
The field mut be an integer field.
> id I use 22.5 (which i can't anyway for other reasons) nothing gets
stored at all. ?
Wouldn't it be sensible to show your code, only the offending part please!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: comma as decimal point?
am 12.01.2007 21:22:11 von kim
> You mean using ASP and the Jet engine?
> The above should be named a string, numbers have no points or commas.
>
> usng ASP-vbs:
>
> s1 = "22.5"
> s2 = replace(s1,".",",")
>
> usng ASP-jscript:
>
> s1 = '22.5';
> s2 = s1.replace(/\./,',');
>
>> This won't work, if I use 22,5 it gets rounded up to 23
>
> So why do you need it then?
>
> The field mut be an integer field.
>
>> id I use 22.5 (which i can't anyway for other reasons) nothing gets
> stored at all. ?
>
> Wouldn't it be sensible to show your code, only the offending part please!
>
I have to sum up these numbers later, can't use string for that (?)
Kim
Re: comma as decimal point?
am 12.01.2007 22:15:43 von exjxw.hannivoort
Kim wrote on 12 jan 2007 in microsoft.public.inetserver.asp.db:
>> You mean using ASP and the Jet engine?
>> The above should be named a string, numbers have no points or commas.
>>
>> usng ASP-vbs:
>>
>> s1 = "22.5"
>> s2 = replace(s1,".",",")
>>
>> usng ASP-jscript:
>>
>> s1 = '22.5';
>> s2 = s1.replace(/\./,',');
>>
>>> This won't work, if I use 22,5 it gets rounded up to 23
>>
>> So why do you need it then?
>>
>> The field mut be an integer field.
>>
>>> id I use 22.5 (which i can't anyway for other reasons) nothing gets
>> stored at all. ?
>>
>> Wouldn't it be sensible to show your code, only the offending part
>> please!
>>
> I have to sum up these numbers later, can't use string for that (?)
If you are talking about a number with either point/period or a comma as
a decimal devider, you must be talking about a string reprsentation of a
number, since numbers in itself are just that and are stored in memory or
in a database in various not human readable often floating point ways.
So if you want to store these numbers AS A NUMBER in your database,
and you are right to do that, you loose the format in which they were
represented on your screen.
1e3, 1000, 1000.0, 501+499 are al stored in the same floating point
numeric database field the same way.
You could store 22.5 or 22,5 as a string in a database field, but there
is not much sense in that. [Only you would skip the conversion of
fractioal numbers to and from binary, that makes some numbers not having
exactly the same value after retrival.]
However, you did not yet answer my 2 Qs above:
>> You mean using ASP and the Jet engine?
>> Wouldn't it be sensible to show your code, only the offending part
>> please!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)