Inserting money type in database from asp.net form!

  • Thread starter Thread starter Jensen bredal
  • Start date Start date
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
 
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,
 
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
 
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]
 
Back
Top