Inserting money type in database from asp.net form!

J

Jensen bredal

Hello gurus,

How do i handle Currencies from "asp.net form field " to "insert " querry in
database?

The "money" is entered in a textbox and my code is falling to the stored
procedure due to wrong currency format.

Any help will be higly cheered!

Thanks
JB
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi Jensen,

It depends of how you keep the value internally in your application, if you
need to do some operation or just show it.

If you need to make any operation with the values ( almost for sure ) you
can keep it as a double, then you can show it using double.ToString("C")
which format it to the locale currency format. if you do this you can save
them using SqlDbType.Float.

Hope this help,
 
J

Jensen bredal

Well the decimal solution , as i have just discoverd is also used in the
Commerce starter kit project. So i guess i ll
use it to .

I have also been tempted by the double "thing" but it always returned
"string has wrong format".

But many thanks to both of you.(IT gods)

J.Bredal





M. Posseth said:
Microsoft recomends the use of the decimal data type in .Net for holding
currency values ( see MSDN )
i use this in all my apps and do not have anny problems

in sql server i store my currency values with the money data type


M. Posseth [MCP]



"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:[email protected]...
Hi Jensen,

It depends of how you keep the value internally in your application, if you
need to do some operation or just show it.

If you need to make any operation with the values ( almost for sure ) you
can keep it as a double, then you can show it using double.ToString("C")
which format it to the locale currency format. if you do this you can save
them using SqlDbType.Float.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


querry
 
M

M. Posseth

Microsoft recomends the use of the decimal data type in .Net for holding
currency values ( see MSDN )
i use this in all my apps and do not have anny problems

in sql server i store my currency values with the money data type


M. Posseth [MCP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top