views:

40

answers:

1

Hi,

I have my form set in french as well, and it automatically changes the text format to use ','. However When I try to insert my values into the database it says cannot convert nvarchar to decimal?

Worst case, Is there a way I can disable the numbers from changing to use ',' and just use '.' always regardless what language it is?

My working language is vb.net

Thanks,

Robert

A: 

If you're passing the values down to the database as nvarchar then you'll need to have converted this to a string using yourDecimalValue.ToString(Globalization.CultureInfo.InvariantCulture) or similar. SQL Server will always expect a decimal to be in 1.23 format - you can imagine the trouble that would result if queries including WHERE myvalue IN (1,25, 1,33, 1,45) were submitted!

Will A
Another option is to not use query strings directly and instead use stored procedures - where you can just set the parameter value to a Decimal and no Decimal -> String conversion is involved.
Will A
Is it possible to keep the numbers with decimal places, rather show "," . is it a universal setting?
Robert
Where would you want them to show ","? In the client program - probably I guess - when passed down to SQL - definitely not.
Will A