views:

309

answers:

1

MS SQL Server's Money Data Type seems to accept a well formatted currency value with no problem (example: $52,334.50) From my research MS SQL Sever just ignores the "$" and "," characters. ASP .NET has a parameter object that has a Type/DbType property and Currency is an available option to set as a value. However, when I set the parameter Type or DbType to currency it will not accept a value like $52,334.50. I receive an error "Input string was not in a correct format." when I try to Update/Insert. If I don't include the "$" or "," characters it seems to work fine. Also, if I don't specify the Type or DbType for the parameter it seems to work fine also. Is this just standard behavior that the parameter object with its Type set to currency will still reject "$" and "," characters in ASP .NET?

Here's an example of the parameter declaration (in the .aspx page):

<asp:Parameter Name="ImplementCost" DbType="Currency" />

So here is a little more information: The code snippet that I provided above is part of the Update parameters to an Update command declared for an SqlDatasSource Control. That parameter will update a column (of money type) of a table in my database. The column in my database is bound to a control in a DetailsView control.

A: 

Look at the overrides on Parse - one of them accepts a format type parameter, one of the valid values being currency.

Tom Clarkson
Not sure if this is going to work in my particular situation. Application crashes before the OnInserting event occurrs...
Rudi Ramey