Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the decimal Separator

Status
Not open for further replies.

zakkar

Programmer
Dec 3, 2002
72
GR
Hello I'm new in Asp and i need some help here.
I using Oracle 8i and i'm writting asp pages.When i retrieve data from the database i have a decimal value which the output is like this. "3,5".The problem for me is that the code i have write few lines below ,i dynamically construct the update sql statement.But when i executed i get the oracle error invalid user table etc.My statement is ok but i have this trouble with the decimal separator
I must sent to the database 3.5 and not 3,5 because i havethe regional settings which are in Europe.I built a loop which replaces the "," whith "." but it is not generall.If i sent this to America i will have problems
How can i Write Asp Code where i can loop ,find regional settings and replaces the "," with "." no matter what value i have???Can I do that?The formatnumber function or fix etc doesn't solve my problem
Thank you in advance.

PS the database sees the record 3.5 but when i write
rs("mydecimalfield") it returns 3,5 which i have serious problem with that.
 
check out the REPLACE command in ASP this will do what you need, although if you have this data you may need to convert existing ,'s to something else first e.g. :

Dim myVar
myVar="123.456,7"

myVar=replace(myVar,",","#") ' replace existing , with a #
myVar=replace(myVar,".",",") ' replace the . with ,
myVar=replace(myVar,"#",".") ' replace the # with .

you could probably make this code into a single line, but I've done it in three to show the workings.
 
Thank you very much .It worked for me.I ought you one
Zkar Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top