Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SQL Insert using comma as decimal

Guest
Dec 06, 2006 Dec 06, 2006
How to insert a number using comma as a decimal separator?
I'm in Brazil, here the number format is "1.000,00" or "1000,00"
I´m trying to use the DW default ASP Insert/Update behavior to insert a comma separated number in SQL
Insert Exemples:
"10,99" as numeric - [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '99'.
"10,99" as text (work with ms access db) - [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to numeric.
"10.99" as numeric - works ok
"10.99" as text - works ok
TOPICS
Server side applications
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2006 Dec 07, 2006
"oteacher" <webforumsuser@macromedia.com> wrote in message
news:el7n0e$7an$1@forums.macromedia.com...
> How to insert a number using comma as a decimal separator?

It's not going to work. You'll have to do a find and replace.

myNumber = Replace(Replace(Request.Form("numberField"),".",""),",",".")

The inner replace removes all decimal points (because you indicated that
might be used as a thousands separator), then the outer replace replaces all
commas with decimal points. Using FormatNumber when you write the number to
the screen will format it as you're used to, but the number must be inserted
with a regular decimal point.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 07, 2006 Dec 07, 2006
Ok, i've imagined that, but how do i raplace a form field server side with the DW Update behavior?
I can't alter the fields after they are submitted.
Maybe a sort of Form Validation Routine?
I'd like to make this transparent to the final user.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2006 Dec 07, 2006
LATEST
Write your own insert using DW's command object, not the built-in insert
record behavior. It's shorter and cleaner, and you can do your own
validation and processing before inserting the record.

"oteacher" <webforumsuser@macromedia.com> wrote in message
news:el9g54$d5q$1@forums.macromedia.com...
> Ok, i've imagined that, but how do i raplace a form field server side with
> the
> DW Update behavior?
> I can't alter the fields after they are submitted.
> Maybe a sort of Form Validation Routine?
> I'd like to make this transparent to the final user.
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines