Money in sql server 2000 with ASP.NET 2.0

Posted on 2006-03-29
Last Modified: 2008-03-17
I have a table with a field of type money.
This field gets its currency according to the culture and I format
It in a formview to show the currency symbol:
<asp:TextBox ID="AmountTextBox" runat="server" Text='<%# Bind("Amount", "{0:C}") %>'></asp:TextBox>
When I update this field I get an error:
Input string was not in a correct format.
I update with the following command:

UPDATE Candidate SET Amount = CONVERT (money, @Amount)  WHERE (Candidate_id = @Candidate_id)

If I run the following script in sql query analyzer with a value of $300 it run and update OK. If I put it into a stored procedure and run it - its OK
If I run the store procedure with open in sql query analyzer it gives an error:
Invalid value..
What is the problem here?
Question by:ANAT2403
    1 Comment

    Accepted Solution

    I found the solution to remove the currency symbol before the updating with the parsing command:
           Decimal tempdec = Decimal.Parse(temp22.Text, System.Globalization.NumberStyles.Currency);
    I I had $300 I now have 300.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now