Inserting money type in database from asp.net form!

Discussion in 'ASP .Net' started by Jensen bredal, Jun 15, 2004.

  1. 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
    Jensen bredal, Jun 15, 2004
    #1
    1. Advertising

  2. 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


    "Jensen bredal" <> wrote in message
    news:eo4%...
    > 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
    >
    >
    >
    >
    >
    Ignacio Machin \( .NET/ C# MVP \), Jun 15, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:cankbt$bln$...
    >
    > 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:...
    > > 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
    > >
    > >
    > > "Jensen bredal" <> wrote in message
    > > news:eo4%...
    > > > 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
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Jensen bredal, Jun 15, 2004
    #3
  4. Jensen bredal

    M. Posseth Guest

    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:...
    > 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
    >
    >
    > "Jensen bredal" <> wrote in message
    > news:eo4%...
    > > 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
    > >
    > >
    > >
    > >
    > >

    >
    >
    M. Posseth, Jun 16, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hfk0
    Replies:
    5
    Views:
    667
  2. Sam
    Replies:
    1
    Views:
    8,793
    Prnda76
    Feb 11, 2010
  3. Batista, Facundo

    Money data type

    Batista, Facundo, Sep 17, 2003, in forum: Python
    Replies:
    3
    Views:
    356
    Asun Friere
    Sep 18, 2003
  4. geeteshss
    Replies:
    0
    Views:
    407
    geeteshss
    Jun 20, 2007
  5. Sam
    Replies:
    0
    Views:
    188
Loading...

Share This Page